Set timer method

Command group Flag affected Reversible Execute on client Platform(s)
Methods NO YES NO All

Syntax

Set timer method interval (seconds) sec [name/]name

Description

This command calls the specified method at regular intervals while waiting for a keyboard input; the called method should preferably be one contained in a code class. You could use this command for automatic telephone dialing, regular checks for electronic mail, and so on.

The command specifies the timer method and the interval in seconds between calls to the timer method. This interval can be between 1 and 30,000 in the form "n sec" where n is the number of seconds. Omnis will start the next timer method when the method which is currently executing, finishes. Timer methods cannot operate in real time as Omnis will not execute a timer method while another method is running or when an OK or Yes/No message is displayed on the screen.

The timer method in your code class should not contain a Quit all methods as this will terminate any Enter data commands which are running. You can also use an Enter data inside a timer method: if so and you do not clear the timer method, the timer method continues to be active while Omnis carries out the Enter data part of the timer method.

You can use Set timer method in a reversible block, in which case the timer method is cleared when the executing method terminates.

Note that (from Studio 11 onwards) the timer method runs in the context of the current task, therefore you can access its task variables from the method. Note that the timer method will continue to run after the task closes.

Example

# Call the method Timer every 5 seconds
Set timer method 5 sec Timer
# method Timer
OK message {Timer method triggered}