Generate macro on the fly and run it using API

Is there a way for me to generate a macro, and store this macro in a variable in PowerShell (or any other programming languages), and run this macro through API (or any other ways in addition to API)?

This was possible in iMacros but I can’t seem to find a similar solution with UI.Vision.

You must use cmd commands to do this

https://ui.vision/rpa/docs#cmd

All command in imacros are available in ui vision, i use imacros from 15 years and i can confirm ui vision can do every works, need only to choice good commands.

1 Like

I already looked through the documentation and sample codes but couldn’t figure out how to do it perhaps due to my inexperience with UI.Vision.

Would you be able to point out exactly which command line and how to use it to accomplish what I described in my first post?

I used iMacros before, too. I remember what you mean. You could build the macro inside the scripting language and then send it to iMacros for execution without saving it to the hard-drive.

UI Vision can not do directly the same, but almost. If you want, you can still build and create the macro inside your script. The only difference is that you need to save the JSON macro file before calling it. That is only one line more :wink:

The UI Vision macro follows standard JSON syntax, that makes it easy to create the macro file programmatically. Then save the macro to the hard-drive into the UI Vision macro folder (or sub folder). Then call this macro via command line and make sure you use &storage=xfile

So if your file is called macro.json then the command line to start it is

"C:\Program Files\Mozilla Firefox\firefox.exe" "file:///D:/test/ui.vision.html?macro=macro.json&direct=1&storage=xfile

See also

1 Like

I guess this also works despite requiring a few more steps in the scripting programming language to deal with the temporary JSON macro file.

Ideally, the scripting programming language needs to create the temporary JSON macro file, then run it using UI Vision, then delete it right after UI Vision finishes. This code portion to deal with the temporary JSON file only needs to be written once and reused in all scripting programming language code files.

Thank you very much for the solution.

Thanks for the good answer. This is a request we often see. For example, users tell us that they need to react on the UI.Vision API return values and generate new macros according to the extracts from the webpage.

=> We created a Powershell demo script for this. It shows how to generate commands in the script and send them to the extension via the api. It works exactly as described by @Plankton above.

Hey guys, I know this post is a little old now. However, I am trying to do what the original poster said in the title of the message. However, I don’t want to open the webpage every time the macro runs. I want it to just run on the current open page. Basically, I have an event listener that when triggered, I need a macro to run on that same page without loading the page from scratch.
I am using chrome. I see many people use firefox here. I can use firefox if needed. I prefer it on mac, but can use windows too, if that is what is needed to accomplish this.

The ultimate goal here is just to modify the value of a few inputs on the page. Normally, I would just use javascript, however, those inputs have some event listeners on them which no matter what javascript method I use, are ignored. However, when I run a macro to change the value of the input, it works. So I am just trying to automate that now.

Any suggestions?