Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
10.5
11.0
11.1
11.2
11.3
11.4
11.5
12.0
12.1
12.2
Statistic
FMM
Blog
FM.RunScript
Runs a script in any open FileMaker file.
Component | Version | macOS | Windows | Linux | Server | iOS SDK | License |
FM | 1.2 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes | Paid |
MBS( "FM.RunScript"; FileName; ScriptName { ; ScriptParameter; ScriptControl } ) More
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
FileName | The name of the FileMaker File that contains the script | ||
ScriptName | The name of the script to run. | ||
ScriptParameter | The Parameter to Pass to the script. | Optional | |
ScriptControl | Available in MBS FileMaker Plugin 9.3 or newer. The script control mode. Can be Pause, Halt, Exit or Resume. Default is Pause. |
"pause" | Optional |
Description
Runs a script in any open FileMaker file.You can also pass a text string to the Script as a Parameter. The parameter can be retrieved by using Get(ScriptParameter) in the script that plug-in is calling. The basic concept behind triggering scripts with a plug-in is as follows. In order for the Plug-in to call a script it must be part of a calculation that is evaluated. For example to cause a script to run when a field is exited, you place the MBS function call in the auto-enter calculation of the field you want to serve as the trigger. When the field is exited the Auto-enter calculation is evaluated and the MBS function is fired off.. Placing the function call in the Field Validation calculation of the trigger field will cause the script to run on Record Exit. NOT on field Exit. This is because Validations by calculation happen at when the record is exited. Anywhere you have access to the calculation dialog you can place a Script trigger function. When the calculation is evaluated the script will run. This includes the new conditional formatting calculations that can be placed on many layout objects. While this opens up new opportunities, you might find that your script is being called continuously.
see also FM.RunScriptIdle, FM.RunScriptLater and Schedule functions.
With plugin version 6.0 or newer the script name can be a script ID number. In that case the plugin queries the script name for the given script ID. This allows to call scripts by ID and avoid problems if scripts are later renamed.
FileMaker 19.2 adds a fmplugin extended privileges. You my need to add such an extended privileges to allow the plugin to trigger scripts. See FileMaker product documentation for details.
Examples
Trigger a script
Let(
[
trigger = MBS("FM.RunScript"; Get(FileName); "Triggered Script"; "")
];
1
)
Trigger script by ID:
MBS( "FM.RunScript"; "test.fmp12"; "12" /* PrintRecords */; "Hello World")
See also
- App.OpenFile
- AVPlayer.AddView
- DragDrop.CreateWithControl
- FM.QueryCustomFunctionsList
- FM.RunDatabaseDesignReport
- FM.RunSaveAsXML
- FM.RunScriptIdle
- FM.StopScriptIdle
- ImageView.CreateWithControl
- TextView.CreateWithControl
Release notes
- Version 9.3
- Added mode parameter to FM.RunScript and EventMonitor.SetCardWindow functions.
Example Databases
- ScriptTriggers/Trigger Script On Field Exit
- ScriptTriggers/Trigger Script On New Record
- ScriptTriggers/Trigger Script On Record Exit
- Utility functions/RunScript
- Utility functions/Schedules
Blog Entries
Created 18th August 2014, last changed 11st December 2019
FM.RunSaveAsXML - FM.RunScriptIdle
Feedback: Report problem or ask question.
