Easily filter/comment/remove junk steps

UI.V tends to record a lot of junk steps that are unneccesary and bog the performance of the macro down. For example, when recording in iMacros, it would only save the “type” command, whereas UI.V will record the “click” and the “type” command which means that a 300 line iim is now a 1,200 line recording in UI.V. Wouldn’t be an issue, except it bogs the run down a lot. A clean run will take <10 seconds, whereas the dirty version takes 2-3 minutes. Going through 1,200 lines of code and commenting out or removing each individual junk step takes hours. If there was a way to only save or easily filter for steps that only actually do something it would save me a ton of time.

I guess a quick and dirty way to do it would be to do a find and replace of “Command”: “click” with “Command”: “comment”… which may actually accomplish most of what I’m complaining about here. Just feature suggestion, I guess.

Update: Yup, basic replace all cut run time down from 5 minutes to under 30 seconds for the entire script without breaking anything.

I add that I don’t create the macros using the ui vision record command but I write the code directly using external tools to detect the xpaths and then I insert them directly into the macro code so as not to have superfluous commands.
In your case you could open the file with the macro with notepad++ and with a regex delete the superfluous commands.
Each added command takes time and slows down the macro for this reason I have always suggested creating very short macro codes so they are quick and easy to modify

Writing each macro individually is simply unworkable for me due to the amount of macros I have to maintain - For example, I have well over 5,000 lines of code in UI.V alone (in table view), and 50,000+ lines of code in iMacros. One macro that I use dozens of times a day has 1,200 lines of code in table view, or close to 15,000 lines of JSON code.

UI.V saving multiple identifiers is actually very useful for me, as a lot of my workload involves data automation where there may be 5+ variations of the same form and I will often be able to use the same macro as one of the identifiers will remain the same even though the element name will change. Which is a reason why ui.v not saving the multiple identifiers in local storage mode annoys me so much.

I did indeed use notepad++ as mentioned and it significantly improved the speed of my workflow without breaking anything.

image

It is not the length of the macro that makes the quality but its simplicity.
I have been writing automations for 4 years and I automate everything and over time I understood that short but very efficient and fast macro codes can be written, for example you can save parts of macros to be loaded after perhaps by linking them to a csv for the variables to be updated to have always a short but fast and efficient and easily adaptable macro code.
Each line in ui vision slows down (even the comment lines) so the shorter the macros the more efficient they will be but writing short code often requires you to think a lot and know many ui vision commands

Of course, but the issue is that my macros have to take hundreds of actions on a constantly morphing input interface, so writing each step manually is not plausible, nor is going through and removing each individual line. If I had to fine tune it to such a degree then I’d spend more time adjusting my scripts than the time savings it would create.

I’m fine with an extra 15 seconds with a quick n dirty replace all comment, but the imacros recording interface shows that it shouldn’t be necessary in the first place.

And I do agree that it’s possible to do some great optimization like you have mentioned, but what is the point? We’re not trying to fit everything into a 4K Atari ROM. 90/10 rule. No reason to spend that other 90% of the time to squeeze out an additional 10% performance on a script that could be made obsolete tomorrow.

Noted! This will be fixed ASAP.

1 Like

As far as the Ui.Vision recording logic goes, we will also look into this and see if we can improve it further. Thanks for the useful feedback and good discussion.

2 Likes