Set macro speed (autodelay)

Syntax1 - set speed

spe [timeMS]

 

Syntax2 - get speed

int spe([context])

 

Parameters

timeMS - time (milliseconds) to wait after macro commands. 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).

 

Remarks

Syntax1

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, dou, mou (/4), key, outp, str.setsel, run, act, clo, min, max, res, siz, mov, ont, hid, men, but, web. It is also applied to some user-defined functions, including ArrangeWindows, RestoreMultiWinPos, MouseWheel, MouseButtonX, Acc.Mouse, Htm.Mouse, Htm.ClickAsync.

 

In macros and menu/toolbar items, initial autodelay is as specified in Options (default is 100 milliseconds). In functions, initial autodelay is 0.

 

spe changes autodelay only for current function or macro, not for functions that it calls. If an 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 an user-defined function, add wait -2 at the end.

 

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

 

See also: opt getopt Options window

 

Examples

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