Problem with xrun when running batch file with bat extension or converted exe file

Can xRUN run .vbs files? Doesn’t seem to work on my end…

Sure it can. It works just like with batch or powershell or python scripts.

Example: The VBS takes the input, squares it and returns it via exit code:

Code:

VBS:

' Display command line arguments (if any)

'You can access command line parameters in VBS directly with 
' WScript.Arguments.Item(0)
' WScript.Arguments.Item(1) etc

'Get the first argument and square it

n = WScript.Arguments.Item(0)

' Do something!
n = n * n

' Send exit code to UI.Vision 
WScript.Quit n

RPA xrun macro:

{
  "Name": "vbs test",
  "CreationDate": "2020-2-15",
  "Commands": [
    {
      "Command": "store",
      "Target": "5",
      "Value": "a"
    },
    {
      "Command": "XRunAndWait",
      "Target": "c:\\test\\square.vbs",
      "Value": "${a}"
    },
    {
      "Command": "echo",
      "Target": "exitcode=${!xrun_exitcode}",
      "Value": "green"
    }
  ]
}
1 Like