AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SetTimer and Sleep

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
beardboy



Joined: 02 Mar 2004
Posts: 444
Location: SLC, Utah

PostPosted: Sat May 01, 2004 5:06 pm    Post subject: SetTimer and Sleep Reply with quote

I'm running into a problem where if a Timer is called in the middle of a Sleep command when the Timer tries to return it never returns.
Code:
143: IniRead,title,%inifile%,Window%A_Index%,Title
144: IniRead,type,%inifile%,Window%A_Index%,Type
145: IF type is not number
146: {
147: Break
175: Sleep,250 (0.01)
351: presstime2 = %A_MDay%%A_hour%%A_Min%%A_Sec%
352: IF presstime2 >= %presstime%
353: {
354: ToolTip
355: SetTimer,ToolTipOff,off
356: }
357: Return (50.10)

The Sleep was the very last line of 154 line Loop. But I have put it at the begining, in the middle, and at the end. And everytime it gets stuck like that is when the Timer is called during the Sleep. The timer is Rajat's time check to turn off SplashText.

I did a small test script and it does the same thing. But it appear to only happen when you turn off the Timer within the Timer.
Code:
SetTimer, Test, 250

Loop
{
  SetTimer, Test, on
  IniRead, VPNMsg, %systemroot%\system32\ProxyED.ini, General, VPNMsg ; Check INI value
  Sleep, 1000
}

Test:
IniRead, temp, %systemroot%\system32\ProxyED.ini, General, AutoVPN ; Check INI value
SetTimer, Test, off
return

Code:
006: SetTimer,Test,250
008: Loop
009: {
010: SetTimer,Test,on
011: IniRead,VPNMsg,%systemroot%\system32\ProxyED.ini,General,VPNMsg
012: Sleep,1000 (0.25)
016: IniRead,temp,%systemroot%\system32\ProxyED.ini,General,AutoVPN
017: SetTimer,Test,off
018: Return (191.01)

thanks,
beardboy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Sat May 01, 2004 6:10 pm    Post subject: Reply with quote

Thanks for a very nice bug report; it helped me find the problem very quickly.

I've updated the installer again:
Fixed: If a script had exactly one timer and it turned itself off during a Sleep or other delay, the script would sleep forever. [thanks beardboy]
Back to top
View user's profile Send private message Send e-mail
beardboy



Joined: 02 Mar 2004
Posts: 444
Location: SLC, Utah

PostPosted: Sat May 01, 2004 6:18 pm    Post subject: Reply with quote

Chris,

Thanks for the quick fix. This was the same problem I was running into before, and thanks to the elapsed time between lines I was finally able to track it down.

thanks,
beardboy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group