Page 1 of 1

Run code once timer reaches X seconds.

Posted: 15 Dec 2021, 21:30
by Elentinus
Found nothing on Google.

Re: Run code once timer reaches X seconds.

Posted: 15 Dec 2021, 21:34
by TLM
Please post some code you've tried and be very specific about what you're trying to do.

Re: Run code once timer reaches X seconds.

Posted: 15 Dec 2021, 21:35
by flyingDman
Search on "autohotkey timer". First result.

Re: Run code once timer reaches X seconds.

Posted: 15 Dec 2021, 21:46
by Elentinus
Basically, I wanna have some code be executed every 200ms. The issue is that block of code doesn't take the same amount of time to execute every time, so I wanna start a timer before the code is executed, execute the code, then once timer reaches 200ms, execute again.

Re: Run code once timer reaches X seconds.

Posted: 16 Dec 2021, 06:34
by mikeyww
That is how a timer works.

Code: Select all

#Persistent
start := A_TickCount
SetTimer, Go, 1000
Return
Go:
list .= A_TickCount - start "`n"
ToolTip, %list%
Sleep, 200
Return
The documentation as already noted above contains additional details and suggestions.