Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.2   7.3   7.4   7.5   8.0   8.1   8.2   8.3   8.4   8.5    Statistic  


Runs a script in any open FileMaker file.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
FM 1.2 Yes Yes No No Yes
MBS( "FM.RunScript"; FileName; ScriptName; ScriptParameter )   More


Parameter Description Example value
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.


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 and FM.RunScriptLater.

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.


Trigger a script

trigger = MBS("FM.RunScript"; Get(FileName); "Triggered Script"; "")

See also

Example Databases

Created 18th August 2014, last changed 30th January 2018

FM.RunDataDesignReport   -   FM.RunScriptIdle

Feedback: Report problem or ask question.

MBS Xojo Plugins