 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Mon Mar 15, 2010 10:28 pm Post subject: 2 scripts running at the same time? |
|
|
Hi, I have two scripts that search for 2 different images on my screen at the same time. My codes are as follow:
| Code: | ^1::
imagesearch (...image1...)
more commands ..
return
^2::
imagesearch (...image2...)
more commands ..
return |
If I press control+2, then the contro+1 script stops working. I can not combine them because they need to be run independently. If I split them into 2 separate script, then my laptop runs really slow. How should I code so that I can run the 2 imagesearchs simultaneously? Thanks for your help in advance. |
|
| Back to top |
|
 |
Scratch
Joined: 22 Jan 2009 Posts: 72
|
Posted: Mon Mar 15, 2010 10:52 pm Post subject: |
|
|
I wouldn't know, I could only generally advice to make the image snapshots as small as possible (the smallest rectangle of pixels that still uniquely identifies the whole image) and try to prevent full screen imagesearches, but confine the searches to the smallest area in wich you expect these snapshots to appear.
That wouldn't grant your wish for a combo search in one scripts, but maybe less slowing down in concurrend script.
Could you also try to compile the seperate scripts into standalone .EXEs and see if these doesn't slow donw the laptop, maybe, just maybe this would free them from (guessing wildly here) the overhead of having to compete over access to the same imagesearch process in the AHK interpreter?
Or maybe it has something to do with that the hotkeys are pressed again / interrupted / default thread time-out exceeeded before the thread finishes, maybe using a single script, but try altering the interrupt times something like:
Thread, interrupt, 200, 8000 ; Make each thread interruptible after 200ms or 8000 lines, whichever comes first (estimate how long hotkey initiated commands take to complete and adjust numbers accordingly). Perhaps this would buy some time for the hotkey initiated thread to start/finish cleanly (again guessing wildly) |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Mar 16, 2010 12:26 am Post subject: |
|
|
| Thanks, Scratch, I will compile one of the script and try to narrow down the search area. If anyone else has other suggestions, I'm listening... |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|