Set macro speed (autodelay)

Syntax1 - set speed

spe [ms]

 

Syntax2 - get speed

int spe([context])

 

Parts

ms - number of milliseconds to wait after macro commands. Integer from 0 to 60000. Use -1 to inherit caller's speed or, if there is no direct caller, the speed that is set in Options. Use -2 to set the speed that is set in Options. 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 speed. Speed is changed locally - only for current instance of function or macro.

 

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

 

Often, reason of run-time error is that macro runs too fast. To give other applications some time to process input, and this way increase macro reliability, after macro commands can be automatically inserted some delay (autodelay). When macro starts, autodelay is as specified in Options (default is 100 milliseconds). For functions, initial autodelay is always 0.

 

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, CB_SelectItem, CB_SelectString, LB_SelectItem, LB_SelectString, Acc.Mouse, Htm.Mouse.

 

Tips: To add autodelay feature for an user-defined function, add wait -2 at the end. Also, if it contains above functions (lef, rig, ArrangeWindows, etc), add spe -1 at the beginning.

 

See also: opt getopt Options window

 

Examples

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