Page 1 of 1

How to call a funtion without waiting first with SetTimer?

Posted: 23 Jul 2018, 03:49
by Wiceramond
I searched and couldn't find anything about it.

Code: Select all

PgUp::
SetTimer, LittleTimer, 4000
Return

PgDn::
SetTimer, LittleTimer, Off
Return

SetTimer:
MsgBox,,,Woo
Return
If I run this code, when I press the hotkey timer waits for 4 seconds and then runs the function. But I want it to run immediately when I press the hotkey and wait 4 seconds for next run.

Thank You.

Re: How to call a funtion without waiting first with SetTimer?  Topic is solved

Posted: 23 Jul 2018, 08:41
by gregster
add a gosub, LittleTimer:

Code: Select all

PgUp::
gosub, LittleTimer
SetTimer, LittleTimer, 4000
Return
If I run this code, when I press the hotkey timer waits for 4 seconds and then runs the function.
I doubt it. If you have a timer named LittleTimer in your hotkeys - then the label should also be LittleTimer, not SetTimer:

Code: Select all

LittleTimer:
MsgBox,,,Woo
Return