Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides
New in version: 5.4   6.0   6.1   6.2   6.3   6.4   6.5   7.0   7.1   7.2    Statistic  

HotKey.Register

Registers a global hot key based on the virtual key code and modifiers.

Component: HotKey
Version: 5.0
Mac OS X: Yes
Windows: Yes
Server: No
FileMaker Cloud: No

MBS( "HotKey.Register"; Code; Modifiers { ; Exclusive; FileName; ScriptName; Local; Name; Tag } )

Parameters

Parameter Description Example value
Code The virtual key code of the key to watch. Can be number or name of key. "F5"
Modifiers The keyboard modifiers to look for. Can be number of text. Text can include command, shift, alpha, option and control.
Added in 6.2 for Windows: RightShift, RightOption and RightControl.
"control"
Exclusive Optional
Pass 1 to register exclusive or 0 for non exclusive.
0
FileName Optional
The database file name where the script is located.
"test.fmp12"
ScriptName Optional
The script name.
"MyScript"
Local Optional
Pass 1 to have hotkey only run script if FileMaker is frontmost. Else pass 0 (default) to have a global hotkey.
0
Name Optional
The name for the hotkey.
e.g. you can use this property to later decide in a script what to do.
"Test Hotkey"
Tag Optional
The tag for the hotkey.
e.g. you can use this property to later decide in a script what to do.

Result

Returns reference or error.

Description

Registers a global hot key based on the virtual key code and modifiers.
Only one such combination can exist for the current application, i.e. multiple entities in the same application cannot register for the same hot key combination. The same hot key can, however, be registered by multiple applications. This means that multiple applications can potentially be notified when a particular hot key is requested.
You can request exclusive registration for your process by passing 1 for exclusive parameter.
Please use HotKey.SetScript to assign a script for the hotkey or use parameters here.

Added Windows support with version 5.2.

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.

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")]

Register key 37 (L on US keyboard) with modifiers:

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

Register Control-F5 for showing/hiding data viewer:

Set Variable [$hotkey; Value:MBS("HotKey.Register"; "F5"; "control")]
Set Variable [$r; Value:MBS( "HotKey.SetEvaluate"; $hotkey; "MBS(\"Menubar.RunMenuCommand\"; 49297)" )]

See also


HotKey.List   -   HotKey.SetEnabled

Feedback: Report problem or ask question.




Links
MBS Realbasic Chart Plugins - Christians Software aus Nickenich