Command Line API does not work

Hi,
I still have the need to run a macro and the new ui vision html file method is not working at all, unfortunately.

I keep getting the file not found error and UI.Vision and the macro are not loaded.
The deprecated model, though, seems to work fine and calls the subroutine, but I believe it is not recommended.

Macros are stored in Google Chrome, although this is a Desktop application.
Here is the batch file I am using:
:::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::: Variables :::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::

set folder=SIFAC_150/505_Ferias/
set macro=Chama_ferias_folha
set var1=01.2021
set direct=1
set storage=0
set closeBrowser=0
set closeRPA=0
set continueInLastUsedTab=0
set loadmacrotree=1

::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::: Chrome ::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::

START “” “C:\Program Files\Google\Chrome\Application\chrome.exe”
ping -n 15 localhost >nul 2>&1

::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::: Ui Vision :::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::

START “” “C:\Program Files\Google\Chrome\Application\chrome.exe” “file:///C:\Users\wilso\Desktop\uivision\test\bat\autorun.html?direct=%direct%&macro=%macro%&savelog=log1.txt&cmd_var1=%var1%&closeBrowser=%closeBrowser%&closeRPA=%closeRPA%&continueInLastUsedTab=%continueInLastUsedTab%&loadmacrotree=%loadmacrotree%”
ping -n 10 localhost >nul 2>&1

::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::: Exit :::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::

EXIT

Thanks in advance

If your macros are in the browser put in storage=browser

Also, I noticed you left out the folder. You are calling Chama_ferias_folha from the “root” folder when it should be SIFAC_150/505_Ferias/Chama_ferias_folha

Hi User9898,
Thank you for the quick reply.
The create autorun HTML command generated two files: autorun.html and start-Chama_ferias_folha. I stored them on the same folder as the batch file.

I tried the two options below without success, received the message File cannot be accessed.

START “” “C:\Program Files\Google\Chrome\Application\chrome.exe” “file:///C:\Users\wilso\Desktop\uivision\test\bat\autorun.html?direct=1&macro=start-Chama_ferias_folha&folder=SIFAC_150/505_Ferias/&storage=browser&savelog=log1.txt&cmd_var1=01.2021&closeBrowser=0&closeRPA=0&continueInLastUsedTab=0&loadmacrotree=1” ping -n 10 localhost >nul 2>&1

START “” “C:\Program Files\Google\Chrome\Application\chrome.exe” “file:///C:\Users\wilso\Desktop\uivision\test\bat\autorun.html?direct=1&macro=Chama_ferias_folha&folder=SIFAC_150/505_Ferias/&storage=browser&savelog=log1.txt&cmd_var1=01.2021&closeBrowser=0&closeRPA=0&continueInLastUsedTab=0&loadmacrotree=1” ping -n 10 localhost >nul 2>&1

I tried a third option, that I believe it is the deprecated mode, the file was found, macro started but the !cmd_var1 internal variable did not receive the parameter passed: 01.2021.
Please see below:

set folder=SIFAC_150/505_Ferias/
set macro=start-Chama_ferias_folha
set var1=01.2021
set direct=1
set storage=browser
set closeBrowser=0
set closeRPA=0
set continueInLastUsedTab=0
set loadmacrotree=1

START “” “C:\Program Files\Google\Chrome\Application\chrome.exe” “file:///C:\Users\wilso\Desktop\uivision\test\bat\start-Chama_ferias_folha.html?folder=%folder%&cmd_var1=%var1%&direct=%direct%&closeBrowser=%closeBrowser%&closeRPA=%closeRPA%&continueInLastUsedTab=%continueInLastUsedTab%&loadmacrotree=%loadmacrotree%”
ping -n 10 localhost >nul 2>&1

Here is the log:

  • [info]

Executing: | store | ${!cmd_var1} | Mes_e_ano |

  • [info]

Executing: | comment | store // fast | !replayspeed |

  • [info]

Executing: | executeScript_Sandbox | return ${Mes_e_ano}.split(".")[0].trim(); | Mes |

  • [info]

Executing: | executeScript_Sandbox | return ${Mes_e_ano}.split(".")[1].trim(); | Ano |

  • [error]

Line 9: Error in executeScript_Sandbox code: Cannot read property ‘trim’ of undefined

  • [info]

Macro failed (Runtime 0.28s)

I also noticed that the !cmd_var1 variable didn’t even show on the Variables panel.

Please let me know if there is something wrong with my batch.

Thanks again.

Hmm generate a brand new autorun.html from settings > API > Generate Autostart HTML page and use &macro=SIFAC_150/505_Ferias/Chama_ferias_folha

Hi,
I tried it again with a new autorun HTML alone in the folder, tried with the start-Chama_ferias.html in the same folder and used the two command lines below. Unfortunately, it cannot access the file. Any other ideas?
Thanks!

With folder command
START “” “C:\Program Files\Google\Chrome\Application\chrome.exe” “file:///C:\Users\wilso\Desktop\uivision\test\bat\autorun.html?direct=1&macro=SIFAC_150/505_Ferias/Chama_ferias_folha&folder=SIFAC_150/505_Ferias/&storage=browser&savelog=log1.txt&cmd_var1=01.2021&closeBrowser=0&closeRPA=0&continueInLastUsedTab=0&loadmacrotree=1”
ping -n 10 localhost >nul 2>&1

Without folder command
START “” “C:\Program Files\Google\Chrome\Application\chrome.exe” “file:///C:\Users\wilso\Desktop\uivision\test\bat\autorun.html?direct=1&macro=SIFAC_150/505_Ferias/Chama_ferias_folha&storage=browser&savelog=log1.txt&cmd_var1=01.2021&closeBrowser=0&closeRPA=0&continueInLastUsedTab=0&loadmacrotree=1”
ping -n 10 localhost >nul 2>&1

I was having a similar issue. Try and call the macro html file directly instead of calling the ui.vision autorun HTML (which I presume you renamed after you generated?). I didn’t seem to need to call the ui.vision html

Like This:
“file:///C:\Users\wilso\Desktop\uivision\test\bat\SIFAC_150/505_Ferias/Chama_ferias_folha.html?direct=1&…

Also try opening a random webpage while starting the macro - this seems to give the autostart page time to load.

Example:
“C:\Program Files\Google\Chrome\Application\chrome.exe” www.mywebsite.com, "file:///C:\Users\wilso\Desktop\uivision\test\bat\SIFAC_150/505_Ferias/Chama_ferias_folha.html?direct=1&…

Hi Darko,

Your suggestion is, I believe, the deprecated mode for running the command line API.

I tried again your suggestions and the parameter passed to the macro from the command line, cmd_var1= 01.2021, still did not work. It did not show as !cmd_var1 variable after the macro started and it causes an error because this a needed value to it.

I also moved the parameter cmd_var1 closer to and farther from the macro name in the command, but it made no difference.

Thanks for taking your time to share your knowledge.

I would remove all parameters and only start the autorun by itself. You should get the “Starting Browser and UI.Vision…” and then one by one add in everything until you find where the issue is.

I am not sure what the issue is, but you find some code snippets here. Maybe they help!?

Hi,
I’ve tried that before and tried again now, same results. I will find a work around for the data taht woul be passed through cmd_var variable.
Thanks!

Hi Ulrich,
I’ve got the my Windows batch file from there.
Thank you

2 posts were split to a new topic: Cmd_var1 question