Set application = WScript.CreateObject("PowerPoint.Application")

' Get arguments
If WScript.Arguments.Length > 0 Then
    textSize = WScript.Arguments(0)
    textStyle = WScript.Arguments(1)
    textColor = Split(WScript.Arguments.Unnamed.Item(2), ",")
    textFont = WScript.Arguments(3)
Else
    Call Err.Raise(60003, , "Text properties are not provided")
End If

If application.SlideShowWindows.Count > 0 Then
    ' Run when in presentation mode
    Call Err.Raise(60002, , "PowerPoint is in presentation mode. Cannot perform operation.")
Else
    ' Run when not in presentation mode
    With application.ActiveWindow.Selection.TextRange.Font
        .Name = textFont
        .Size = textSize
        .Color = RGB(textColor(0), textColor(1), textColor(2))
        ' Set text styles
        If InStr(textStyle, "BOLD") > 0 Then
            .Bold = True
		Else
			.Bold = False
        End If

        If InStr(textStyle, "ITALIC") > 0 Then
            .Italic = True
		Else
			.Italic = False	
        End If

        If InStr(textStyle, "UNDERLINE") > 0 Then
            .Underline = True
		Else
			.Underline = False
        End If
    End With
    
End If