SetMouseDelay

Sets the delay that will occur after each mouse movement or click.

SetMouseDelay, Delay

 

Parameters

Delay Time in milliseconds, which can be an expression. Use -1 for no delay at all and 0 for the smallest possible delay. If unset, the default delay is 10.

 

Remarks

A short delay (sleep) is automatically and invisibly done after every mouse movement or click generated by MouseMove, MouseClick, and MouseClickDrag. This is done to improve the reliability of scripts because a window sometimes can't keep up with a rapid flood of mouse events.

Due to the granularity of the OS's time-keeping system, delays 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).

A delay of 0 internally executes a Sleep(0), which yields the remainder of the script's timeslice to any other process that may need it. If there is none, Sleep(0) will not sleep at all. By contrast, a delay of -1 will never sleep.

The built-in variable A_MouseDelay contains the current setting.

Every newly launched thread (such as a hotkey, custom menu item, or timed subroutine) starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part of the script).

 

Related

MouseMove, MouseClick, MouseClickDrag, SetKeyDelay, SetControlDelay, SetWinDelay, SetBatchLines

 

Example

SetMouseDelay, 0