Set macro speed (autodelay)

Syntax1 - set speed

spe [timeMS]


Syntax2 - get speed

int spe([context])



timeMS - autodelay time in milliseconds. Can be 0 to 60000. Default: 0.

context - if omitted or 0, returns current macro/function speed. If -1 or -2, returns caller's or global speed (see above).




Changes autodelay for subsequent commands.


Autodelay is a small wait time automatically added after macro commands. It makes the macro more reliable, because then the target window has more time to process input. It makes the macro slower.


Autodelay is applied to:

lef, rig, mid, dou, mou (/4), key, paste/outp, str.setsel, run, act, clo, min, max, res, siz, mov, hid, men, but, web, wait WT, MouseWheel, MouseButtonX, ArrangeWindows, RestoreMultiWinPos, CloseWindowsOf, Acc.Mouse, Acc.CbSelect, Htm.Mouse, Htm.ClickAsync, WindowText.Mouse.


In macros and menu/toolbar/autotext items, default (initial) autodelay is 100 ms, or as set with RtOptions. In functions and member functions, initial autodelay is 0.


spe changes autodelay only for current function or macro, not for functions that it calls. If a user defined function wants to use caller's speed, insert this at the beginning of the function: spe -1 .


Tips: To add autodelay feature for a user-defined function, add wait -2 at the end.


Syntax2: Returns current autodelay (does not change). Alternatively, use getopt function.


See also: opt, getopt, window.



 Set macro speed (wait 50 ms after macro commands):
spe 50
 Set maximal speed: