Regency Posted April 17, 2009 Share Posted April 17, 2009 Ok, so i have a timer sentance that works perfectly, but now i need it to check for a second time within the first check. What should i edit it to make it wait for an hour and 30 min. Local $begin = '' Local $dif = 0 While 2 Sleep(10) $dif = Int(TimerDiff($begin) / 1000) If $dif >= (.5 * 60) Then MyFunction2() $begin = TimerInit() EndIf WEnd How would i edit this to make it wait for also an hour and thirty min, while still watching for the (.5 * 60)? Link to comment Share on other sites More sharing options...
zorphnog Posted April 17, 2009 Share Posted April 17, 2009 You would need two timers since your $dif >= (.5 * 60) expression is resetting the $begin timer. Something like:$timer1 = TimerInit() $timer2 = $timer1 While 1 Sleep(10) $dif1 = Int(TimerDiff($timer1) / 1000) If $dif >= (.5 * 60) Then MyFunction2() $timer1 = TimerInit() EndIf $dif2 = Int(TimerDiff($timer1) / 1000) If $dif2 >= 5400 Then ;5400 secs = 1 1/2 hour DoSomething() $timer2 = TimerInit() EndIf WEnd Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 17, 2009 Share Posted April 17, 2009 You would need two timers since your $dif >= (.5 * 60) expression is resetting the $begin timer. Something like: $timer1 = TimerInit() $timer2 = $timer1 While 1 Sleep(10) $dif1 = Int(TimerDiff($timer1) / 1000) If $dif >= (.5 * 60) Then MyFunction2() $timer1 = TimerInit() EndIf $dif2 = Int(TimerDiff($timer1) / 1000) If $dif2 >= 5400 Then;5400 secs = 1 1/2 hour DoSomething() $timer2 = TimerInit() EndIf WEnd Good solution, but that second TimerDiff() needs to use $timer2 vice $timer1. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now