Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


Sets which script to call if hotkey is pressed.

Component Version macOS Windows Linux Server iOS SDK
HotKey 5.0 ✅ Yes ✅ Yes ❌ No ❌ No ❌ No
MBS( "HotKey.SetScript"; HotKeyRef; Filename; ScriptName { ; Parameter } )   More


Parameter Description Example Flags
HotKeyRef The reference value for the hotkey as returned by HotKey.Register function. $hotkey
Filename The database file name where the script is located. "test.fmp12"
ScriptName The script name. "MyScript"
Parameter The parameter to pass.
If empty or not defined, we pass the HotKey reference number.


Returns OK or error.


Sets which script to call if hotkey is pressed.
Use HotKey.GetTag to query a tag value if needed.

Default parameter passed to the script is the HotKey reference number. On macOS we include a second parameter to indicate whether it is KeyDown or KeyUp (see HotKey.SetKeyUp).

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.

Notice: FileMaker 19.2 adds a fmplugin extended privileges. If you have such an extended privileges to allow the plugin to trigger scripts, you need to grant permissions for it. If such a privilege is not defined, the plugin is allowed to trigger scripts. See FileMaker product documentation for details.


Register Control-F5:

Set Field [HotKeys::HotKey ID; MBS("HotKey.Register"; "F5"; "control")]
Set Variable [$r; Value:MBS("HotKey.SetScript"; HotKeys::HotKey ID; Get(FileName); "HotkeyAction")]

See also

Release notes

Example Databases

Blog Entries

This function is free to use.

Created 4th February 2015, last changed 20th February 2022

HotKey.SetPermanent - HotKey.SetScriptWorkspaceOnly