SCRIPT_SCHEDULE Function
Syntax
V SCRIPT_SCHEDULE(C script name, C time of day[, N slot ])
Arguments
- scriptCharacter
The name of a script or function. The Script_Name parameter can include an optional library name if you which to specify a script that is in a different database (.alb file), or is in a dictionary of a table or set that is not attached to the current database.
- timeCharacter
The time for the script to play back. The time is specified as a string with the following format: HH:MM. The hour must be specified using a 24 hour count.
- slotNumeric
A value between 1 and 10 inclusive that specifies which schedule timer to use. There are ten timers available. If no parameter is specified timer 1 is used. There can only be one script assigned to each timer.
Description
Schedule a script for playback at a specific time.
Discussion
The SCRIPT_SCHEDULE() function schedules a script for playback at a specific time. To cancel a previously scheduled script, assign a NULL string to the appropriate Timer.
Once a script is played, it is removed from the script schedule. For example, if a script is played on schedule at 8AM, it will not play at 8AM the next day, unless it is rescheduled.
The script schedule remains in force for the duration of your Alpha Anywhere session. Once you quit Alpha Anywhere, the script schedule is forgotten.
Examples
This script schedules script "Foo" to play at 1 AM.
script_schedule("Foo", "1")
Schedules the script 'Foo2' to play at 8:30 PM using timer 2.
script_schedule("Foo2", "20:30", 2)
Cancels the script scheduled by timer 3.
script_schedule("", "0", 3)
The following script depends on a table named scheduled_scripts with two fields.
- Field Name
- Type, Width, and Decimal
- Script_order
N, 3, 0
- Script_name
C, 20, 0
Make an index for the table named Script_order, whose order expression is: Script_Order. Then make a script named Batch_Script as follows:
dim num_scripts as N dim curr_script as N btbl = table.open("sheduled_scripts") btbl.index_primary_put("Script_order") num_scripts = btbl.records_get() FOR curr_script = 1 to num_scripts btbl.fetch(num_script) Xbasic_wait_for_idle() script_play(btbl.Script_name) curr_script = curr_script + 1 NEXT
To run a series of scripts, make the appropriate entries in your table, then run:
script_schedule("Batch_Script", "21:00", 1)
Thanks To
Melvin Davidson
Limitations
Desktop applications only.
See Also