AutoHotkey Community

It is currently May 27th, 2012, 5:40 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: March 15th, 2010, 11:28 pm 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 15th, 2010, 11:52 pm 
Offline

Joined: January 22nd, 2009, 3:43 pm
Posts: 84
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)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2010, 1:26 am 
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...


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: HotkeyStick, mrhobbeys and 56 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group