Jump to content

Delete


Recommended Posts

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
Link to comment
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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...