asynchronous routines

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Trautmann
Newbie
Posts: 9
Joined: Fri Jun 12, 2009 6:35 pm

asynchronous routines

Post by Trautmann » Tue Aug 18, 2009 10:13 am

Probably a daft question

Is there any way I can run a routine asynchronously? I have a subroutine checking for over a 100 images in a window, these images usually appear around the same place so I have narrowed down the search area but its still taking time, time in which I could have the macro doing something else. Rather than use smaller images and a smaller search area (its pretty small already) could I somehow background the image search, maybe vbscript (which I don't know that well)?

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

Use multiple compiled macros.

Post by gdyvig » Tue Aug 18, 2009 1:25 pm

If you have Pro version of Macro Scheduler you can create compiled macros that run in the background independently of the main macro. They may be started from the command line or from within the main macro using the RunProgram command where you previously set RP_WAIT to 0.

You still need to devise a way of communicating the results to the main macro.

You will also want to run some experiments to determine how many simultaneously running macros Windows can handle before you reach the point of diminishing returns.



Gale

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

Or use multiple scp scripts or script instances.

Post by gdyvig » Tue Aug 18, 2009 2:23 pm

If you only have the standard version of Macro Scheduler you can do the same thing by running msched.exe against an scp file:

"C:\Program Files\Macro Scheduler 11\msched.exe" Dialog Example
or

"C:\Program Files\Macro Scheduler 11\msched.exe" "\Dialog Example.scp"

You may run as many as you like, you can even run multiple instances of the same macro.

You will need to orchestrate them so they do not collide on common resources, for example writing to file opened by another macro.

Gale

Trautmann
Newbie
Posts: 9
Joined: Fri Jun 12, 2009 6:35 pm

Post by Trautmann » Tue Aug 18, 2009 9:34 pm

Thanks both for the input,

Sorta thought seperate exes was the way to go (have pro version btw), I suppose as long as I handle the result files ok it would work.

Cheers

Edit - Sorry I read it as 2 separate answers from different sources! Thanks Gale

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

One one option that might speed things up.

Post by gdyvig » Tue Aug 18, 2009 9:44 pm

Another approach that might speed up your macro when you are looking for many items on the screen before it changes is to do a screencapture to make and use the resulting bmp file multiple times instead of using the FindImagePos SCREEN option.

This way FindImagePos will not have to recapture the entire screen (and create a new tempfile in the background) for each bitmap you check.


Gale

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts