Hello Stefan,
The runWindowsScript command uses this resource
cscript to work.
I have some examples of how I use the command.
JavaScript
defVar --name exitCode --type Numeric
defVar --name output --type String
defVar --name error --type String
runWindowsScript --scripttype "JScript" --source "Text" --script "var actions = [\r\n \"Brazil\"\r\n , \"United States\"\r\n , \"Italy\"\r\n];\r\nvar actions_id = Math.floor(Math.random() * actions.length);\r\nmsg = actions[actions_id];\r\nWScript.Echo(msg);" --blockexecution exitCode=exitcode output=output error=error
trimString --text "${output}" --trimoption "TrimEnd" output=value
logMessage --message "Output Random [${output}]" --type "Info"
Visual Basic - How to get a return of the command
defVar --name exit --type Numeric
defVar --name output --type String
defVar --name error --type String
runWindowsScript --scripttype "VBScript" --source "Text" --script "WScript.Echo \"IBM RPA\"\r\nWScript.StdOut.Write \"IBM \"\r\nWScript.StdOut.WriteLine \"RDA\"" --blockexecution exit=exitcode output=output error=error
logMessage --message " ${output}" --type "Info"
runWindowsScript --scripttype "VBScript" --source "Text" --script "Dim StdOut : Set StdOut = CreateObject(\"Scripting.FileSystemObject\").GetStandardStream(1)\r\n\r\nStdout.WriteLine \"IBM Process\"\r\nStdout.Write \"IBM Workflow\"" --blockexecution exit=exitcode output=output error=error
logMessage --message "${output}" --type "Info"
Visual Basic - logging into SAP GUI
defVar --name mySAP --type Window
defVar --name sucesso --type Boolean
defVar --name exitCode --type Numeric
defVar --name output --type String
defVar --name error --type String
findWindow --id "wnd[0]" --classname GuiMainWindow --processname saplogon --comment "SAP Easy Access" mySAP=value sucesso=success
focusWindow --window ${mySAP}
runWindowsScript --scripttype "VBScript" --source "Text" --script "If Not IsObject(application) Then\r\n Set SapGuiAuto = GetObject(\"SAPGUI\")\r\n Set application = SapGuiAuto.GetScriptingEngine\r\nEnd If\r\nIf Not IsObject(connection) Then\r\n Set connection = application.Children(0)\r\nEnd If\r\nIf Not IsObject(session) Then\r\n Set session = connection.Children(0)\r\nEnd If\r\nIf IsObject(WScript) Then\r\n WScript.ConnectObject session, \"on\"\r\n WScript.ConnectObject application, \"on\"\r\nEnd If\r\nsession.findById(\"wnd[0]\").maximize\r\nsession.findById(\"wnd[0]/usr/txtRSYST-BNAME\").text = \"user\"\r\nsession.findById(\"wnd[0]/usr/pwdRSYST-BCODE\").text = \"pass\"\r\nsession.findById(\"wnd[0]\").sendVKey 0" --blockexecution exitCode=exitcode output=output error=error
logMessage --message "\r\nExitCode: ${exitCode}\r\nOutput: ${output}\r\nError: ${error}" --type "Info"
I hope it helps.
------------------------------
Angelo Alves
WW Elite Team IBM RPA
------------------------------