Sign in to follow this  
Followers 0
Mattraks

Delete

5 posts in this topic

#1 ·  Posted (edited)

Delete

Edited by Mattraks

Share this post


Link to post
Share on other sites



I think the TimerInit() is what you want, because it will increase every second, and you can set a variable checking if it 1 sec.

Share this post


Link to post
Share on other sites

Ok, i have a button and i want to make a timer and after 1 second increase a variable. The question is how do i make a timer and tell if it has been 1 second or not?

You could just do Sleep(1000) if you don't need the rest of the script to be responsive during that time.

Otherwise, initialize a variable with TimerInit() and check it with TimerDiff(). The difference is given in milliseconds. See the examples in the help file.

:)


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

Share this post


Link to post
Share on other sites

Maybe:

$Time = TimerInit()
While 1
    $Diff=TimerDiff($Time)
    If $Diff >= 1000 then ToolTip("1 sec")
    Sleep(5)
WEnd

Or maybe:

$Diff=0
$Time = TimerInit()
While $Diff < 1000
    $Diff=TimerDiff($Time)
    Sleep(5)
WEnd
Tooltip("test")
Sleep(1500)

But sleep(1000) is much better if you need to sleep for 1 sec.

Share this post


Link to post
Share on other sites

Or you could use a _Timer_SetTimer with a 1000 ms (1 second) elapse and wouldn't need to check if a second has elapsed in the loop


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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