CNS Plug-ins

Create an Interval Script Event

To create an inverval script event, use the MMScript_CreateIntervalScriptEvent function. The format of the function is as follows:

MMScript_CreateIntervalScriptEvent(
EventName;
Script;
Interval {;
DB {;
EventValue {;
StartDateTime {;
Repeat {;
Persistent {;
Priority {;
CurrentScript
}}}}}}} )

The quickest way to schedule a script using this function is:

MMScript_CreateIntervalScriptEvent( “MyEvent” ; “MyScript” ; “1h 30m” )

The above code will run the script “MyScript” in one hour and thirty minutes.

This function is quite flexible. You can use it to repeat a script at any interval and you can have it start on a certain day. For example, you could use this plug-in to remind you that New Year’s Eve is on its way:

MMScript_CreateIntervalScriptEvent(
“New Years” ; // Event Name
“Reminder - Impending New Year” ; //Script
“15m” ; //Interval
Get ( FileName ) ; // DB
“It’s Almost a New Year!” ; //EventValue
“12/31/2006 1:00:00 PM”; //StartDateTime
True //Repeat
)

The above code would start triggering the script “Reminder - Impending New Year” on December 31, 2006 every 15 minutes. The script “Reminder - Impending New Year” could display your script parameter, “It’s Almost a New Year!” in a custom dialog. Further, the dialog could ask if you wanted to continue the alert or cancel it. If you wanted to continue it, no further action would be needed. If you wanted to cancel it, you could use the MMScript_CancelScriptEvent function as follows:

MMScript_CancelScriptEvent( “New Years” )

Do not worry, canceling the “New Years” event will not actually stop the new year from arriving. ;-)