Use the Timer object to trigger an Action Command after a specific amount of time has elapsed. You can use Timer objects to create simple slide shows, timed tests and animations.
To create a Timer object, use the mouse to draw a rectangle where you would like the object to appear. (The placement of the Timer object is not critical, since it will not be visible when running the App.) The Timer properties can now be edited through the Properties Panel, allowing you to define the object’s behavior.
Timer objects can be activated either manually or automatically. Set the auto-start property to true to activate the Timer immediately whenever the page it’s on is displayed. If auto-start is off, the Timer will remain inactive until it receives a TimerStart command. You might choose to have the Timer sit dormant until the user clicks a Push Button or responds to a MessageBox. For example:
TimerStart "Timer1" "2000"
The Timer interval is specified in milliseconds (one-thousandth of a second) using its interval property. For a one second interval enter 1000 milliseconds. For one minute interval enter 60000 milliseconds. Once activated, this is the amount of time that will elapse before the Actions associated with the Timer are executed.
Once activated, a Timer will execute repeatedly until manually stopped, the current Page is changed or the App shuts down. The assigned Action commands will be executed each time the timer’s interval is reached.
You can deactivate the Timer manually using the TimerStop Action. For example:
You can use the Variable (to store elapsed time) to keep track of how many milliseconds the Timer has been running. To use this option, enter a variable name into the field. At runtime, this variable can be examined to determine how long the Timer has been running. This feature could be used to create a rudimentary stopwatch. For example, you could track how long a reader took to complete a test:
Convert the elapsed time from milliseconds to minutes.
Math "[ElapsedTime]/60000" "2" "[Score]"
AlertBox "Hello" "You took [Score] minutes to finish the test."
The Timer object supports only a single Action Event called expired. The Actions entered here will be executed when the Timer’s internal counter reaches the specified interval. (See Understanding Actions and Variables and Action Command Reference for a complete discussion of the Action Editor and Action Commands.) After the Actions have been executed, the Timer will be reset and begin counting from zero again unless it has been deactivated. If you do not want your Timer Action to execute more than once, include a TimerStop command in the Timer’s Action.
Created with the Personal Edition of HelpNDoc: Effortlessly Convert Your Word Doc to an eBook: A Step-by-Step Guide