RPA Desktop Macro Runs Very Slow

Hi - I’ve got a macro working but it’s very, very slow. Sure there is a problem with my setup/script.

I’ve got the replay speed set to fast and I have this as my first entry in my macro (not sure its needed but its there!)

{
  "Command": "store",
  "Target": "fast",
  "Value": "!replayspeed"
},

As an example this portion of my macro takes between 4/5 seconds to find the button and click on it. The image its looking for is on the screen the full 4/5 seconds - waiting.

{
  "Command": "do",
  "Target": "",
  "Value": ""
},
{
  "Command": "visualSearch",
  "Target": "ToolsMenu_dpi_192.png",
  "Value": "found"
},
{
  "Command": "repeatIf",
  "Target": "${found} == 0",
  "Value": ""
},
{
  "Command": "XClick",
  "Target": "ToolsMenu_dpi_192.png",
  "Value": ""
},

bound to be something I’m doing (or not doing!) - any pointers gratefully received

Thanks
Pat

Are you on the latest version 5.9.5?

yep… Just checked

New browsers are very slow compared to old browsers.

I also use imacros on firefox 56 and after 15 hours of work it requires only 300 mega ram, instead ui vision after 2 hours of work takes up 5 giga of ram so it is normal that it is very slow because it consumes a lot of resources in the operating system.

Maybe - but these numbers are straight into firing off the macro rather than it running for hours before seeing a degradation.

The macro fires and a couple of seconds in I get these 5 second pauses

You check how much memory your browser uses, I periodically with firefox erase memory otherwise after a while it consumes all the memory and slows down the execution.

I empty my ramy every 20 minutes with firefox when I have ui vision running.

yeah - thats not going to be it I’m afraid - I launch Firefox from the command line in order to run the macro. Firefox only starts when the macro is required and closes when the macro completes.

So Firefox is only running for VERY short times and only for UI Vision purposes.

(I do appreciate your input)

A possibile solution can be reduced this value !timeout_wait

Warning, if you use 1 second only some commands can show error for hight speed.

Hi, can you add a screen video of the issue? Maybe we can see something then.

Unfortunately the timeout_wait value hasn’t helped

Hi - I’ve put together a video to show the issue - thanks
Screencast Dropbox Link

As said before - I’m so new to this UIVision thing its got to be something I’m doing (or not!)

Strikes me I’ve done something incredibly unhelpful and not included the script !

  {
 "Name": "PayrollManagerAutomation",
 "CreationDate": "2021-1-8",
 "Commands": [
{
  "Command": "comment",
  "Target": "// PAYROLL MANAGER AUTOMATION //",
  "Value": ""
},
{
  "Command": "",
  "Target": "",
  "Value": ""
},
{
  "Command": "store",
  "Target": "fast",
  "Value": "!replayspeed"
},
{
  "Command": "",
  "Target": "",
  "Value": ""
},
{
  "Command": "XRun",
  "Target": "\"C:\\Program Files (x86)\\Moneysoft\\Payroll Manager\\PM3.EXE\"",
  "Value": "\"${!cmd_var1}\""
},
{
  "Command": "comment",
  "Target": "// Check For New Notices",
  "Value": ""
},
{
  "Command": "do",
  "Target": "",
  "Value": ""
},
{
  "Command": "visualSearch",
  "Target": "ToolsMenu_dpi_192.png",
  "Value": "found"
},
{
  "Command": "repeatIf",
  "Target": "${found} == 0",
  "Value": ""
},
{
  "Command": "XClick",
  "Target": "ToolsMenu_dpi_192.png",
  "Value": ""
},
{
  "Command": "",
  "Target": "",
  "Value": ""
},
{
  "Command": "do",
  "Target": "",
  "Value": ""
},
{
  "Command": "visualSearch",
  "Target": "DownloadPAYENoticesMenuOption_dpi_192.png",
  "Value": "found"
},
{
  "Command": "repeatIf",
  "Target": "${found} == 0",
  "Value": ""
},
{
  "Command": "XClick",
  "Target": "DownloadPAYENoticesMenuOption_dpi_192.png",
  "Value": ""
},
{
  "Command": "",
  "Target": "",
  "Value": ""
},
{
  "Command": "do",
  "Target": "",
  "Value": ""
},
{
  "Command": "visualSearch",
  "Target": "CheckForNewNotices_dpi_192.png",
  "Value": "found"
},
{
  "Command": "repeatIf",
  "Target": "${found} == 0",
  "Value": ""
},
{
  "Command": "XClick",
  "Target": "CheckForNewNotices_dpi_192.png",
  "Value": ""
},
{
  "Command": "",
  "Target": "",
  "Value": ""
},
{
  "Command": "do",
  "Target": "",
  "Value": ""
},
{
  "Command": "visualSearch",
  "Target": "OKButton_Notices_dpi_192.png",
  "Value": "found"
},
{
  "Command": "repeatIf",
  "Target": "${found} == 0",
  "Value": ""
},
{
  "Command": "XClick",
  "Target": "OKButton_Notices_dpi_192.png",
  "Value": ""
},
{
  "Command": "",
  "Target": "",
  "Value": ""
},
{
  "Command": "comment",
  "Target": "// ITERATE AND SELECT ANY NOTICES TO APPLY",
  "Value": ""
},
{
  "Command": "do",
  "Target": "",
  "Value": ""
},
{
  "Command": "visualSearch",
  "Target": "nonoticestoapply_dpi_192.png",
  "Value": "noNoticesFound"
},
{
  "Command": "visualSearch",
  "Target": "nonoticestoapply_dpi_192.png",
  "Value": "noticesFound"
},
{
  "Command": "if_v2",
  "Target": "${noticesFound} == 1",
  "Value": ""
},
{
  "Command": "XClick",
  "Target": "nonoticestoapply_dpi_192.png",
  "Value": ""
},
{
  "Command": "end",
  "Target": "",
  "Value": ""
},
{
  "Command": "repeatIf",
  "Target": "${noNoticesFound} == 0",
  "Value": ""
},
{
  "Command": "",
  "Target": "",
  "Value": ""
},
{
  "Command": "comment",
  "Target": "Open File Listing and see if new entry",
  "Value": ""
},
{
  "Command": "do",
  "Target": "",
  "Value": ""
},
{
  "Command": "visualSearch",
  "Target": "OKButton_Notices_dpi_192.png",
  "Value": "found"
},
{
  "Command": "repeatIf",
  "Target": "${found} == 0",
  "Value": ""
},
{
  "Command": "XClick",
  "Target": "OKButton_Notices_dpi_192.png",
  "Value": ""
},
{
  "Command": "",
  "Target": "",
  "Value": ""
},
{
  "Command": "comment",
  "Target": "// CLOSE PAYROLL MANAGER",
  "Value": ""
},
{
  "Command": "do",
  "Target": "",
  "Value": ""
},
{
  "Command": "visualSearch",
  "Target": "FileMenu_dpi_192.png",
  "Value": "found"
},
{
  "Command": "repeatIf",
  "Target": "${found} == 0",
  "Value": ""
},
{
  "Command": "XClick",
  "Target": "FileMenu_dpi_192.png",
  "Value": ""
},
{
  "Command": "",
  "Target": "",
  "Value": ""
},
{
  "Command": "do",
  "Target": "",
  "Value": ""
},
{
  "Command": "visualSearch",
  "Target": "ExitMenuOption_dpi_192.png",
  "Value": "found"
},
{
  "Command": "repeatIf",
  "Target": "${found} == 0",
  "Value": ""
},
{
  "Command": "XClick",
  "Target": "ExitMenuOption_dpi_192.png",
  "Value": ""
}]}

Sorry to drag this up again - performance is really an issue here, is the performance in that video I posted what people would expect from a desktop macro or should I be expecting better performance?

Just seems to sit there at the points it “looks” for an image on the screen for ages before it recognises it’s there…

In my experience, your video seems to be running ok. Yes, that’s the “expected” speed with XClicks.

Thanks for the screencast, its very helpful. As @trexem said, the speed is normal, so you did nothing wrong :wink:

Pattern matching runs in this (slow) speed because you are on a HiDpi screen (I know this, because I see _dpi_192 in your macro)

How to speed up a computer vision macro:

  • If you can, do the automation on a regular 96dpi screen and/or use a smaller screen size. The larger the screen, the longer the image search takes.

  • Instead of using XClick with image search to click on an item, automate with keyboard shortcuts (XType) if possible. Of course, this only works if the app supports keyboard shortcuts.

  • Limit the search area: You can use the visionLimitSearchArea and visionLimitSearchAreaRelative commands for this. In your example I see that you automate a desktop application. In this case you can limit the image search area to the area of this application. This makes the automation faster and more robust. If you look at the “DemoXDesktopAutomation” macro (Subroutine Sub_XDesktopAutomation_Area) you see that we use this ourselves for the demo.

PS: Last but not least we plan to improve the image search algorithms further and increase the performance. It is on our todo list. The new xmodules V2021-1 already improve the image search speed by ~10-20%, and much more is planned.

Update March 2021: The new XModules version V2021-3 is available. It cuts down image search time by up to 50%. More speed improvements are planned.

@trexem @admin - thanks for the input… Nice to know I haven’t been a complete idiot which is what I was thinking.

Thanks for the pointers on things to try, I’ll get stuck into them and report back. Looking forward to the new modules

1 Like

Just to follow up here…

Been playing for a few days and the pointers given have really sped things up for me.

As @admin alluded (and apologies to anyone who already knows this stuff!).

  • Screen resolution has a massive impact, changing this alone made a huge improvement
  • Xtype wherever possible is the way forward!
  • Limiting the search area again makes quite a difference, just be aware of any popup windows that appear outside of that search area.

Thanks all for their input
Pat

3 Likes