![]() |
Actr_ScheduleEvent |
This function will schedule a script to be automatically triggered in the future.
Syntax
Actr_ScheduleEvent ( switches ; datetimestamp ; fileName ; scriptName ;
yourID ; usertext )
Parameters
switches | set to “-AddSingleEvent” and add optional extra switch |
datetimestamp | the timestamp indicating the date and time the script must be triggered |
fileName | the name of the file that contains the script |
scriptName | the name of the script |
yourID | (optional) a free to use ID that you can supply to identify the event |
usertext | (optional) a free to use text that you can supply for your own needs |
Switches
-AddSingleEvent | always set this switch, to add a single event |
You can now also add this switch:
-DontShowExtendedPrivilegeWarning | show no alert if script triggering fails |
Returned Result
Data type returned
Text
Result
If successful an eventID is returned: this is an internal eventID that the plug-in assigns, for example 4242.
If unsuccessful it returns an error code starting with $$ and the error code. Returned error codes can be:
$$-50 | paramErr | check if your parameters are correct |
$$-41 | memFullErr | not enough memory |
$$-4216 | OLE error (windows) | |
$$-4223 | maximum number of events scheduled (1000) | |
$$-4226 | you can’t schedule an event in the past |
Other errors may be returned.
Originated in
Activator Plug-in 1.2
Compatibility
FileMaker Pro 18 to 2025
Considerations
The date parameter should be in the same format as a FileMaker date field.
The time parameter should be in the same format as a FileMaker time field.
IMPORTANT: Don’t forget to delete triggered events in the triggered scripts, as this might fill up the memory. See Actr_DeleteEvent.
NOTE: You might need to enable “Validate cross-file plug-in access” extended privilege (fmplugin extended privilege) in new newly created fmp12 files, for script triggering to work.
See our web page for more info on how to do this:
Enable “Validate cross-file plug-in access” extended privilege for FMP trigger scripts
New in v10.0: the plug-in now shows an alert dialog when script triggering fails because of insufficient privilege for triggering scripts.
You can add the switch “-DontShowExtendedPrivilegeWarning” no alert is shown if script triggering fails.
Example
Set Field [ result ; Actr_ScheduleEvent ( "-AddSingleEvent" ;
Timestamp ( "12/16/2020" ; "12:22:45 PM" ) ;
"Events.fmp12" ; "TriggerScript1" ; "12345" ; "hi!" ) ]
This command will trigger the script “TriggerScript1” in file “Events.fmp12” on day December 16, 2020, at 12:22:45 PM. Note that this example is somewhat simplified, normally you should not use hardcoded dates like in the above example, as this will only work on a system with US dates. See also example 2, for a more robust example.
Example 2
We assume that in your FileMaker file the following fields are defined:
gTriggerDate Global, date
gTriggerTime Global, time
gEventID Global, number
gTriggerDate and gTriggerTime can be filled with the date and time the script should be triggered. Add the following script step:
Set Field [ gEventID ; Actr_ScheduleEvent ( "-AddSingleEvent" ;
Timestamp ( gTriggerDate ; gTriggerTime ) ; Get ( CurrentFileName ) ;
"TriggerScript" ; Get ( CurrentRecordID ) ; "Check record please." ) ]
This command will trigger the script “TriggerScript” in the current file. It will be triggered on the day and time that are in the global fields gTriggerDate and gTriggerTime.
Used in example files
ScheduleTriggers.fmp12
Everyday.fmp12
Related functions
Actr_Control |
Actr_DeleteEvent |
Actr_GetEventInfo |
Actr_RunScript |
Related script step
Schedule Script Trigger |
Related topics
Activator Plug-in online help (overview)