I'm sorry if I went about this the wrong way, this is essentially a continuation of a previous post but because it's no longer about the Critical command I wanted to make the title reflect the current topic which is why, when I "suspend" the function, it doesn't start back up.
the original thread is here (I've copied over the pertinent information)
http://www.autohotkey.com/forum/viewtopic.php?p=322691#322691
The timed sub runs every 10 seconds, if I run the manual one in between then it does suspend the next timed one. The problem is that when I click OK on the Query in process message from the manual sub, the program stays stuck in a while loop from the timed routine. It's like, the timed routine took priority and until it finishes then the manual one won't start again.
Here is what you can do to test and see what I see, run the program and
wait 10 seconds....
MESSAGE: gonna run and inQuery is ><
Click OK
MESSAGE: Query In Process (From the Timed Call)
Click OK
MESSAGE: Ran Timed Routine
Click OK
Press F4 to start the manual routine
MESSAGE: Query In Process (From the F4 call)
....leave the msgbox open and wait for timed routine to run again....
MESSAGE: gonna run and inQuery is >1<
Click OK
Nothing happens (GOOD, timed routine suspended)
Click OK on the Query In Process (remember: that one is from the manual, so it should finish the manual and unsuspend the timed)
then nothing happens... when I opened the debugger it shows it looping in the timed routine's while loop and inQuery is still 1, the manual routine never changed the value back to 0 and didn't get the message at the end of the manual routine.
Here is the code
Code:
SetTimer, TimedRoutine, 10000
F4::
querytest()
msgbox, inQuery is >%inQuery%<
return
TimedRoutine:
msgbox, gonna run and inQuery is >%inQuery%<
querytest()
msgbox, Ran Timed Routine
return
querytest()
{
global inQuery
While (inQuery) {
}
inQuery := 1
Msgbox, Query In Process
inQuery := 0
}