MarcoSilva Posted July 20, 2007 Share Posted July 20, 2007 With this script, I want that a MsgBox appear if the TimeDiff is greater than the interval specified. Before, i tried with an equal comparison, but if there's some delay in the execution (even if it is 1 sec. delay in the execution), the function is never called, so I make a greater or equal comparison, and this way i'm certain that the function is called, but to stop the main loop being executing the function every time, I reset the variable. But it wont work. Help? #include <GuiConstants.au3> #include <GuiEdit.au3> $GUI_Main = GUICreate("Testing Timer Func", 200, 200) $Input_Interval = GUICtrlCreateInput("5", 10, 10, 50, 20, $ES_NUMBER) GUISetState() $begin = TimerInit() While 1 If Int(TimerDiff($begin)/1000) >= GuiCtrlRead($Input_Interval) Then FTimer() EndIf WEnd Func FTimer() $begin = -1 MsgBox(0,"Time Difference", "This apeared 5 seconds later") EndFunc Link to comment Share on other sites More sharing options...
Developers Jos Posted July 20, 2007 Developers Share Posted July 20, 2007 if you want the couter to restart after the MsgBox(0 is displayed you should do something like: Func FTimer() $begin = -1 MsgBox(0, "Time Difference", "This apeared 5 seconds later") $begin = TimerInit() EndFunc ;==>FTimer SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
MarcoSilva Posted July 21, 2007 Author Share Posted July 21, 2007 (edited) The code I pasted is just an example, because the program is bigger. I already did what you sad before, but that's not the solution I wanted because it could lead me to another problem. Edited July 21, 2007 by MarcoSilva Link to comment Share on other sites More sharing options...
MarcoSilva Posted July 21, 2007 Author Share Posted July 21, 2007 I found the solution myself, thanks for the help 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