Jump to content
Sign in to follow this  
MarcoSilva

Stupid Problem

Recommended Posts

MarcoSilva

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
Jos

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 Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
MarcoSilva

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
MarcoSilva

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  

×