Sign in to follow this  
Followers 0
MarcoSilva

Stupid Problem

4 posts in this topic

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

Share this post


Link to post
Share on other sites



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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by MarcoSilva

Share this post


Link to post
Share on other sites

I found the solution myself, thanks for the help :whistle:

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0