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

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/

See also

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.