scheduler.addTask

Syntax scheduler.addTask (taskTime, scriptString, minutesBetweenRuns)

Params taskTime is a date value, the time for the next run of the task.

scriptString is a string, that gets saved as a script, that's run when task runs.

minutesBetweenRuns is the number of minutes between task runs. If it's 0, the task is deleted after its first run.

Action Adds a new task to the scheduler's tasks table.

Returns The address of the newly allocated task object.

Examples Beeps the speaker an hour from now, and every hour:
scheduler.addTask (clock.now () + 3600, "speaker.beep ()", 60)

   » @user.scheduler.tasks.task1

Beeps the speaker once, an hour from now:
scheduler.addTask (clock.now () + 3600, "speaker.beep ()", 0)

   » @user.scheduler.tasks.task2

Notes The Main menu has a Scheduler submenu which also provides an interface for adding tasks.

All tasks are created in user.scheduler.tasks.

The tasks table is checked once per minute to see if a task needs to be run. Therefore, very precise timing of tasks is not possible using this verb.

Discuss