hi
i write a batch file that do something for me when i use xtype for opening winR and xtype batch name and enter it works but i wanna to run it by xrun so i use xrun and the path of batch file but nothing happen so i convert my batch to exe file but this exe file didnt run by xrun (altough when i double click it myself it runs ) so can any body help to run this file with xrun
tnx
Check your syntax:
XRun | "C:\Users\Path\Path\myprogram.exe"
the syntax is correct
i think xrun command acts on some exe files not all of it
for example write a simple batch file and convert it to exe file by free software except iexpress and see it doesnt work by x run
iexpress have some limitation on path u use batch file but it works by xrun
XRun should work with all kinds of files.
So just to clarify: If you use XRun with a simple batch file, does it work then for you?
If yes: If you start your app (iexpress ?) from batch file, does it work then if the batch file is started via XRun?
hi
xrun works for me when i run for example calc.exe or other exe file i have but when i want to run a simple batch file with extenstion .bat or .cmd it didnt run by xrun so i convert it to exe file by advance bat to exe converter v 4.11 (and some other converter program)and set xrun by this new exe file(which is fine when i mannually double click it)
when i run the macro there is no error or warning bt nothing happen due to my new exe file
so i try some other converter and see when i use iexpress program for converting it could be actually run by xrun but it has limitation of used path that is not good for me
But batch files work great with XRun! => See for example this batch file to delete downloaded files.
If batch files do not work in your setup, “something” is wrong. If you use the file from the post Storing image with consistent filename - #2 by ulrich, does it work then?
Can xRUN run .vbs files? Doesn’t seem to work on my end…
What is the sense to convert a batch file to exe ?
Use batch file and ui vision working like a charm.
I regulary run batch file with xrun command and working well.
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"
}
]
}
Hi can you add details about the ${!xrun_exitcode} i do not know how it works.
I regularly run batch file with ui vision but i do not know how works ${!xrun_exitcode}
What is ${!xrun_exitcode} ?
Where i can take this value ?
How i can use it ?
Thanks
When a script started by XRunAndWait closes (= is completed), XRunAndWait captures the exit code of the script and stores it in !xrun_exitcode
. Typically this is 0. But inside a script you can set this exit code. For example in VBS with WScript.Quit n
Of course, this works only with XRunAndWait, since we get the code only once the script or program is done.
See also Exit status - Wikipedia
In batch files, the exit code is called %ERRORLEVEL%
, see
EXIT /B < exitcodes >
is used to return custom return codes in batch files.
Your script can use this value for example to tell UI.Vision if it was successful or had any error.
Thanks I must study this feature, thanks again
This is a really useful feature. I used it to delete the downloaded pdf files and was experimenting with using both .bat and .vbs scripts.
My .vbs script is written like this:
Set fs = CreateObject(“Scripting.FileSystemObject”)
fs.DeleteFile(“C:\myfolder*.pdf”)
It works when I run it directly, but when I run it using XRUN, it says folder not found.
In the end, I used a .bat script to delete my pdf files.