Product Logo

MMScript

Trigger and schedule scripts

Functions

Reference: XML

NameReference: XML
Description

The <script> tag allows you to define script events for MMScript to call. You need to define at least the db and script attributes to have a valid <script> tag. This is an empty tag, so you can either use a forward-slash before the closing angled bracket (“/>”) or follow the tag immediately with a closing </script> tag. This tag has nine attributes, two of which are required:

db Attribute - Defines the database that contains the script to be called. Specify only the FileName of the database. You can use the Get(FileName) function in a FileMaker Pro calculation to obtain the FileName of the database. This attribute is required.

script Attribute - Defines the name of the script as it appears in your database. This attribute is required.

name Attribute - Defines a user-supplied name of this script event. You can name all of your script events and use the MMScript_GetScriptEventName function to retrieve that name when the actual script is called. This attribute is required if you also define the date, time, interval, repeat, or persistent attributes (so that you can later delete them if you no longer need them); the default value is “”.

value Attribute - Defines a user-supplied value for this script event. You can store any value you want in this attribute and retrieve the value with the MMScript_GetScriptEventValue or Get(ScriptParameter) functions. This attribute is optional; the default value is “”.

date Attribute - Defines the date the script event should occur. This attribute has a very specific form and should look like “01/21/2002”. That is, month, forward-slash, day, forward-slash, four digit year. If you have a date field that you want the event to occur on, you can use something like ‘DateToText(dateField)’ and it should output the correct form. If you are using a non-English version of FileMaker, you may have to use something like ‘Month(dateField) & “/” & Day(dateField) & “/” & Year(dateField)’. This attribute is optional; default value is “”, unless the time attribute is defined, in which case the default value is today’s date.

time Attribute - Defines the time the script event should occur. This attribute has a very specific form and should look like “14:30:00”. That is, 24-hour hour, colon, minutes, colon, seconds. If you have a time field that you want the event to occur on, you can use something like ‘TimeToText(timeField)’ and it should output the correct form. This attribute is optional; default value is “”, unless the date attribute is defined, in which case the default value is midnight (“00:00:00”).

interval Attribute - Defines the interval for the script event. This attribute has a very specific form and should look like “1d 2h 3m 45s”. That is, a number followed by ‘d’ (days), ‘h’ (hours), ‘m’ (minutes), or ‘s’ (seconds), with multiple measurements separated by a space. This attribute is optional; the default value is “”.

repeat Attribute - Defines whether or not the script event should repeat. Used in conjunction with the interval attribute for a repeating script event. Specify either “yes” or “no”. This attribute is optional; the default value is “no”.

persistent Attribute - Defines whether or not this script event should still occur even if FileMaker Pro is closed and reopened later. Specify either “yes” or “no”. This attribute is optional; the default value is “no”.

priority Attribute - Defines how interruptive the script event is. Specify “Low”, “Normal”, “High”, or “Highest”. Default is “Normal”.

currentscript Attribute - Defines what to do with the currently running script (if any). Specify “Halt”, “Exit”, “Resume”, or “Pause”. Default is “Pause”.

idletime Attribute - Defines the amount of time the user must be idle before this script event would occur. The format is the same as the interval Attribute. Default is “”.