Waits the specified amount of time before continuing.

Sleep, Delay



Delay The amount of time to pause (in milliseconds) between 0 and 2147483647 (24 days), which can be an expression.



Due to the granularity of the OS's time-keeping system, Delay might be rounded up to the nearest multiple of 10. For example, a delay between 1 and 10 (inclusive) is equivalent to 10 on Windows XP (and probably NT & 2k).

The actual delay time might wind up being longer than what was requested if the CPU is under load.

A delay of 0 will yield the remainder of the script's current timeslice to any other processes that need it (as long as they are not significantly lower in priority than the script), in which case an actual delay between 0 and 20ms (or more) may occur. If there are no needy processes, there will be no delay at all. However, a Delay of 0 should always wind up being shorter than any longer Delay would have been.

While sleeping, new threads can be launched via hotkey, custom menu item, or timer.

"Sleep -1": If the operating system is Windows NT4/2000/XP or later or AutoHotkey's version is or later, a delay of -1 does not sleep but instead makes the script immediately check its message queue. This can be used to force any pending interruptions to occur at a specific place rather than somewhere more random. See Critical for more details.



SetKeyDelay, SetMouseDelay, SetControlDelay, SetWinDelay, SetBatchLines



Sleep, 1000 ; 1 second