How to Save As PowerShell Script or JavaScript Source

Apologies for the super basic question. Disclaimer: I’m just learning the program.

I just want to know how to save the macro as as a file that I can click on to run the macro, without the web browser being active to begin with. On the UI.Vision home page, they show an example, under the command line API section, where they launch a macro using javascript and PowerShell files. But, I don’t see how to save my macro into those file formats.

Can someone point me in the right direction?

First you need to know how to automatic run UI Vision with a single url path. Take a look in here:

Then, you should learn how to put what at where in the powershell script, so it could run that url path with Chrome/Firefox.

Here is one of my example powershell script in which you put it in a .ps1 file.

Start-Sleep -Seconds 5

Get-Process -Name chrome | ForEach-Object { $_.CloseMainWindow() }

Start-Sleep -Seconds 10

Start-Process -FilePath "C:\Program Files\Google\Chrome\Application\chrome.exe" '--profile-directory="Profile 12"'

Start-Sleep -Seconds 20

Start-Process -FilePath "C:\Program Files\Google\Chrome\Application\chrome.exe" -ArgumentList '"file:///G:/My Drive/uivision/" --profile-directory="Profile 12"'

In this example, it would run the macro filename.json and will close both Chorme and UI Vision RPA window after done.
The &direct=1 must be included so it could auto run.

All you need to do is save it as a .ps1 file, and run it with powershell.

Or you can run it auto with Task Scheduler, you can see it here:

I do appreciate your help kolor_blind. I’m still having difficulty understanding the process - did not make it past the first part - automatically running with a single url. I followed the GitHub link and opened the json files, but just couldn’t make sense of what to do next. Are you aware of a step-by-step video (or other) tutorial that could walk me through the process?

Sorry for being complicated. Actually, all you need is to do this.

Step 1: you go to Xmodules, and choose the folder for your macro, csv file… Normally the default folder is a Folder named uivision and it’s placed in Desktop. In my case, it’s G:/My Drive/uivision


Step 2: you open UI Vision, go to Setting > API > and click this. This would download a html file to your computer, and please move it to your uivision folder. In my case, it’s placed in G:/My Drive/uivision.

Step 3: After that, change it like this:

Step 4: copy and paste all your macro (json file) into the macro folder inside the uivision file, and the csv file into the datasource file. Like this:


Step 5: After that, all you need is this script. Open a notepad, copy paste this into it:

Start-Process -FilePath "C:\Program Files\Google\Chrome\Application\chrome.exe" -ArgumentList '"file:///G:/My Drive/uivision/"'

But you have to replace this: G:/My Drive/uivision with your uivision folder which is the one in Step 2.
And replace filename with the name of the macrop you want.

Then you save this notepad as a .ps1 file. For example, filename.ps1.

Step 6: You open it with powershell and the magic will happen.

But for me, in some cases it doesn’t run that way. But if I use Task Scheduler to run powershell and open that .ps1 file, it will run. You should read about it in here if you got trouble running it the 1st way.

1 Like

Wow! Thank you for this, Kolor_Blind. It’s exactly what I was looking for. :+1:t2: