tim [ns] [function] [flags]
ns - timer period, seconds. Default: 0.
function - name of user-defined function (not macro), which will run every ns seconds. Default: current function.
flags - combination of the following values: 1 - allow multiple instances of function running simultaneously.
Sets timer that periodically executes function. If ns is 0 or omitted, the timer stops. If timer for that function is already set, and ns is not 0, then changes the period of the timer. If the timer function is disabled, it does not run, although the associated timer runs anyway.
The timer function is executed in new thread each time. It is not recommended to use tim with small period (less than 1 s).
Usually it is better to use rep and wait intead of tim. See the example. In dialogs procedures and other window procedures, use SetTimer, KillTimer and WM_TIMER instead.
To make one-shot timer, use tim 0 (stop timer) in that timer function.
You can see currently active timers in the Running Items list (menu Run -> View Active Items). You can right click an item and stop the timer.
Start timer to run function Func every 30 seconds: tim 30 Func Stop it: tim 0 Func Run function Func every 2 seconds: rep wait 2 Func