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)?
asynchronous routines
Moderators: JRL, Dorian (MJT support)
Use multiple compiled macros.
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
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
Or use multiple scp scripts or script instances.
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
"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
One one option that might speed things up.
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
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