Scheduling and Repeating Scripts

Reference:        Programming a Script

                        Script Editor

There are three different timing controls on the operation of a script.  Two of these are commands, and the third is the manner in which the script is started.  The commands control the schedule of a script once it has run the first time. 

The primary command is Repeat_Time.  This command allows you to determine the frequency of the script’s operation.  It also allows you to limit operation to Workdays.  Time_Range is a less frequently used command that allows you to control the operation of the script over a 24 hour period.  This command would be used to force a script to start at a particular time, and to run only until the end of the time range.  For example, the commands:

            :Repeat_Time: 1 Hour, Workdays
            :Time_Range: 18:00-06:00

would cause the script to operate hourly between the hours of 6:00 PM and 6:00 AM.  The script would run only on workdays.

Scripts in development are typically started by running them from the Script Status Program or the Script Editor.  This starts the script immediately.  Repeat_Time and Time_Range commands are ignored.  The script will run once unless a Queue_Script command is used to start another instance.  This is also useful for rerunning a script on an adhoc basis.

Production scripts are started by scheduling them.  This is the only way to cause the Repeat_Time and Time_Range commands to have effect.  It also provides for the creation of multiple instances of a single script, where each instance will repeat independently.  For example, suppose you wish to run a script every Monday and Thursday at 11 PM.  You would include the command:

:Repeat_Time: Weekly

and then create two schedule entries for Monday and Thursday at 11 PM.  The Monday instance would repeat itself every Monday, and the Thursday instance would repeat itself every Thursday.  Two entries for the script would appear in the Scheduled Scripts List of the Script Status program.  This gives you complete flexibility in the scheduled operation of the script.