Invoking a FileMaker script from your Objective-C or Swift code with the FMX_Queue_Script function

To invoke a FileMaker script directly from your Objective-C or Swift code, use the FMX_Queue_Script function.

Format

FMX_Queue_Script(NSString *fileName, NSString *scriptName, FMX_ScriptControl control, NSString *scriptParameter, NSDictionary *variables)

Parameters

fileName - the name of the file that includes the script. The file must be open.

scriptName - the name of the script to run.

control - the action to take if an existing script is running: kFMXT_Halt, kFMXT_Exit, kFMXT_Resume, kFMXT_Pause.

scriptParameter - the parameter to pass to the script. This parameter may be nil.

variables - An NSDictionary that contains key-value pairs that are all NSStrings. Local variables will be created using the keys as the names of the variables and the values as the values of the variables. This parameter may be nil.

Return value

The return value is true if the script is queued, or false if the script can't be queued.

Notes 

  • The FMX_Exports.h header file declares the FMX_Queue_Script function.

  • The user's account must have the fmurlscript extended privilege enabled.

  • If multiple scripts are queued, the scripts run in the order they were queued.

Example 1 

In the following example, the AddEntry script is invoked from the MyScripts file. The myParameter variable points to an NSString, and myVariablesDict is an NSDictorary of variables.

FMX_Queue_Script(@"MyScripts", @"AddEntry", kFMXT_Pause, myParameter, myVariablesDict)