Sleep - GlitchedSouls/AHK-Guide GitHub Wiki

Sleep pauses the script for the amount of time stated.

Sleep, DelayInMilliseconds

Sleeping a specific amount of time.

To sleep for 1 second, do:

Sleep, 1000

To sleep for 1 minute, do:

Sleep, 60000

Sleeping a random amount of time.

In the previous Random Wiki Page tutorial, it explains how to generate a random number. To sleep for a random amount of time, do:

Sleep, RandomNumber

To sleep randomly every time you call the sleep function, you must do:

Random, RandomNumber, 1000, 2000 ; Min - 1 second, Max - 2 second.
Sleep, RandomNumber
Random, RandomNumber, 1000, 2000 ; Min - 1 second, Max - 2 second.
Sleep, RandomNumber

By using the following:

Random, RandomNumber, 1000, 2000 ; Min - 1 second, Max - 2 second.
Sleep, RandomNumber
Sleep, RandomNumber

If the randomly generated number is 1500, then both sleeps will be 1500 (1.5 seconds) and that is not random.

Further information

AHK Documentation - Sleep