CreateTimer()

Summary

Sets up a timer that executes a macro at fixed-time intervals.

Syntax

CreateTimer(string timer_name, integer interval, string macro_name)

Argument Contents
timer_name A name that identifies the timer
interval The time, in milliseconds, between executions of the macro
macro_name The macro to be run at each indicated interval

Notes

  • The name of the timer must be unique; timer_name must not be the name of a timer that is currently active. To reuse a timer name, call DestroyTimer() to cancel the timer.

  • If the macro called by the timer has not finished its work by the time the next timer call is issued, then that next call is not executed or is ignored.

Example

// Every 5 seconds, run a macro called "Update Vehicle Locations"
CreateTimer("GPS Vehicle Locator", 5000, "Update Vehicle Locations")

Error Codes

Error Type Meaning
NotFound A system limit on timers was reached, and no more can be created by any application

See Also

Function Summary
DestroyTimer() Cancels a timer that executes a macro at fixed-time intervals
Pause() Uses a timer to go into a waiting loop that yields to other processes, allowing Windows messages to be dispatched while waiting
Sleep() Uses a timer to go into a busy waiting loop that yields to other processes
CreateStopwatch() Start a stopwatch to track clock time
CheckStopwatch() Determine the elapsed time since a stopwatch was started
DestroyStopwatch() Stops or cancels a stopwatch