Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
HotKey.SetScript
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
Parameters
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. |
Optional |
Result
Returns OK or error.
Description
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.
Examples
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
- HotKey.GetTag
- HotKey.Register
- HotKey.SetKeyUp
- HotKey.SetLocal
- HotKey.SetName
- HotKey.SetScriptWorkspaceOnly
- HotKey.SetTag
Release notes
- Version 12.1
- Added parameter as optional parameter for HotKey.SetScript function to overwrite default parameter.
- Version 10.2
- Added HotKey.SetScriptWorkspaceOnly and HotKey.GetScriptWorkspaceOnly functions.
Example Databases
Blog Entries
This function is free to use.
Created 4th February 2015, last changed 20th February 2022