| View previous topic :: View next topic |
| Author |
Message |
Mike Fay
Joined: 12 Jan 2005 Posts: 13 Location: Atlanta GA USA
|
Posted: Sat Jun 28, 2008 5:40 am Post subject: What happens if I press this button? (Hotkey Threads) |
|
|
Being facetious with the title of this message, but more seriously, I have a couple of questions about the timing of scripts, relative to games:
1) If I have started a script using a particular hotkey, and the script takes a long time to execute in a game (say, 5 seconds), what happens if I hit a second hotkey (for another script) in the middle of the first one. Does it wait for the first to finish (good), or start the second immediately (bad)? If the latter, is there some way to make the second one only start when the first one finishes?
2) With a single long script, I often run into timing issues, a.k.a. I have to play around with Sleep statements. They always seem subject to the worst case scenario, because all kinds of weird things can happen in "the real world" such as a virus scanner kicking in or an IM forcing a festive window to pop up. Is there any way to avoid the Sleep statement altogether and somehow wait until/sense that the application has finished processing the previous AHK script statement before proceeding to the next one? (Is this clear as mud?)
Thanks, AHK, for your GREAT product! Even if the above problems can't be averted, AHK remains a real blessing in terms of tedious button pushing.
Mike
[Title edited. Please write descriptive titles for your topics. ~jaco0646] |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1145 Location: The Interwebs
|
Posted: Sat Jun 28, 2008 5:44 am Post subject: Re: What happens if I press this button? |
|
|
1) Start the next one immediately. To work around this, you could set the original hotkey to critical (through use of the Critical command), which makes it uninterruptible. Or, you could set a variable to something at the start of the hotkey, then clear it once the hotkey is finished, and in the other hotkey check if the variable contains anything.
2)You can't sense if the application has finished processing it except for using ImageSearch to search for some change that would occur in the screen after it finishes processing that command. |
|
| Back to top |
|
 |
Mike Fay
Joined: 12 Jan 2005 Posts: 13 Location: Atlanta GA USA
|
Posted: Sat Jun 28, 2008 5:48 am Post subject: |
|
|
Thanks muchly, Krogdor. Now I know.
Is there anyway blanket statement to make every hotkey in a given .ahk be Critical? And if so, can individual ones then be un-Critical?
One more great thing about AHK - the great support. You guys let me know if you want me to write a letter of praise for your product. I figure you get so many that individual ones don't mean that much any more.
Mike |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1145 Location: The Interwebs
|
Posted: Sat Jun 28, 2008 6:01 am Post subject: |
|
|
| Mike Fay wrote: |
Is there anyway blanket statement to make every hotkey in a given .ahk be Critical?
|
Not that I know of. |
|
| Back to top |
|
 |
|