Jump to content


Photo

SetTimer and Sleep


  • Please log in to reply
2 replies to this topic

#1 beardboy

beardboy
  • Members
  • 443 posts

Posted 01 May 2004 - 04:06 PM

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.
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.
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
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

#2 Chris

Chris
  • Administrators
  • 10727 posts

Posted 01 May 2004 - 05:10 PM

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]

#3 beardboy

beardboy
  • Members
  • 443 posts

Posted 01 May 2004 - 05:18 PM

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