By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

AutoIt Sleep Function

Reference on the AutoIt Sleep Function, used to pause scripts temporally.

Edited: 2012-05-11 03:12

The AutoIt Sleep Function is used to pause scripts for a set amount of time. The sleep function accepts a value in milliseconds, the maximum value is 2147483647 (24 855.1348 days) – If you want the script to pause longer then that, it may be better to create a loop, and repeatedly call sleep from within that loop.

Reminder. 1000 milliseconds equals 1 second.


DelayAmount of time to pause in milliseconds.

AutoIt Sleep Example

The below script will pause for 10 seconds, before clicking a given spot on the screen.

MouseClick("primary", 200, 150, 5)

The next example shows how to use the sleep function in conjunction with AutoIt Random to pause the script for a random amount of time. The below Generates a number between 1000 and 5000, then pauses using the generated number.

sleep(random(1000, 5000, 1)) ; Generates a number between 1000 and 5000