Setting up a timer

A timer allows you to call an event handler every specified number of seconds. The essential steps for creating a timer are:

  1. In a (Declarations) or (Options) script that is global to all the other scripts in the application, use the Dim statement to assign a reference variable to a NotesTimer object.
  2. In executable code, use the Set statement to create the NotesTimer object. The first parameter is the interval, in seconds, at which the event handler is called. The second, optional parameter is any comment. You can also use the CreateTimer object of NotesSession.
  3. Use the On Event statement to establish an event handler for the Alarm event of the NotesTimer object.
  4. Write a user sub to handle the event.

The interval is not guaranteed; other activities on the computer involving script may delay the event.

The following table lists the NotesTimer properties.

Property

Data type

Description

Comment

String

(Read-write) Any comment; second parameter when object is created

Enable

Boolean

(Read-write) True (the default) if the NotesTimer object is active

Interval

Integer

(Read-write) Interval, in seconds, at which the event handler is called; first parameter when object is created