AutoHotkey Community

It is currently May 27th, 2012, 1:11 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: January 8th, 2010, 5:17 pm 
Offline

Joined: September 28th, 2007, 3:56 am
Posts: 279
Location: New York
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

}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 9th, 2010, 9:19 am 
Offline

Joined: December 30th, 2005, 5:01 pm
Posts: 448
Is that the complete code? Because you do nothing in the While loop (or elsewhere) that can exit the loop with variable inQuery.
You can never get out of your While loop :
Code:
While (inQuery) {
   ; doing nothing!
  }


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Leef_me, Ohnitiel and 14 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