Reference > Script triggers reference > OnLayoutKeystroke
 
OnLayoutKeystroke
Performs a script when one or more characters are entered from the keyboard either directly or via an input method editor (IME). Use the Get(TriggerKeystroke) function to return the characters that activated the script trigger.
Two types of characters may cause this trigger to activate:
keys that would normally be applied to an active object
keys normally used for navigation
When the script runs
Before the event has been processed.
Modes in which the trigger can be used
Browse, Find, and Preview modes.
Result
You can use the Exit Script script step within the triggered script to return True or False.
True: The event that triggered the script proceeds.
False: The event that triggered the script is canceled.
Compatibility 
 
Where the script trigger is activated 
Supported 
FileMaker Pro 
Yes 
FileMaker Server 
No 
FileMaker Go 
Partial 
Custom Web Publishing 
No 
FileMaker WebDirect 
No 
Runtime solution 
Yes 
Originated in 
FileMaker Pro 10.0
Notes 
Use the Get(TriggerModifierKeys), Code, and Char functions to work with special characters such as navigational keys like the Tab and the arrow keys, and with general Unicode characters. See the Code function for a list of navigational keys and the codes reported to a script. The Char function returns the characters for Unicode code points.
Keystrokes are processed in the following order:
1. The operating system processes certain keys.
2. FileMaker Pro processes keyboard shortcut keys.
3. An active object with an OnObjectKeystroke script trigger can process a character.
4. An OnLayoutKeystroke script trigger can process a character.
5. Navigational keys are used for navigation, while non-navigational keys are processed by an active object with an OnObjectKeystroke script trigger.
6. If there is no active object, an alert displays for non-navigational keys.
The first of these steps to use the key stops the process. A script executed by the OnObjectKeystroke or OnLayoutKeystroke script trigger can stop further processing of the keystroke by returning False.
Using the arrow keys or mouse to navigate and select within pop-up lists, menus, and calendars will not activate this trigger. Entering text into these fields will activate this trigger.
Windows: The Alt and Ctrl keys do not activate this script trigger.
macOS: The Command key does not activate this script trigger.
FileMaker Go: This trigger is activated only if a field is active when the user enters a keystroke.
If an error in the triggered script causes the script not to finish, the keystroke that triggered the script is not processed.
See Actions that don’t activate script triggers for a list of other actions that do not activate this script trigger.
Related topics 
Setting up script triggers
Setting script triggers for layouts
Setting script triggers for objects