Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
RemoteControl.PressKey
Presses a key.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
RemoteControl | 2.8 | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ❌ No |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
VirtualKey | The platform dependent virtual key code. Pass a number for a virtual key code or pass a string to let the plugin try to lookup the virtual key code. | "a" | |
ScanCode | The platform dependent scan code. Pass a number for a scan code or pass a string to let the plugin try to lookup the virtual key code. If this parameter is missing, the virtual key code is used to lookup the scan code. | "a" | |
down | Whether to press key down or release it. If parameter is missing the plugin will do both. | Optional |
Result
Returns OK on success.
Description
Presses a key.Codes are platform dependent. As a help we allow you to pass the character for the key as text and the plugin looks up virtual key code and scan code. But this lookup can fail. So please try all keys for your keyboard.
Common key codes for MacOS:
Key | Hex KeyCode | Decimal KeyCode |
a | 00 | 0 |
b | 0B | 11 |
c | 08 | 8 |
d | 02 | 2 |
e | 0E | 14 |
f | 03 | 3 |
g | 05 | 5 |
h | 04 | 4 |
i | 22 | 34 |
j | 26 | 38 |
k | 28 | 40 |
l | 25 | 37 |
m | 2E | 46 |
n | 2D | 45 |
o | 1F | 31 |
p | 23 | 35 |
q | 0C | 12 |
r | 0F | 15 |
s | 01 | 1 |
t | 11 | 17 |
u | 20 | 32 |
v | 09 | 9 |
w | 0D | 13 |
x | 07 | 7 |
y | 10 | 16 |
z | 06 | 6 |
0 | 52 | 82 |
1 | 53 | 83 |
2 | 54 | 84 |
3 | 55 | 85 |
4 | 56 | 86 |
5 | 57 | 87 |
6 | 58 | 88 |
7 | 59 | 89 |
8 | 5B | 91 |
9 | 5C | 92 |
F1 | 7A | 122 |
F2 | 78 | 120 |
F3 | 63 | 99 |
F4 | 76 | 118 |
F5 | 60 | 96 |
F6 | 61 | 97 |
F7 | 62 | 98 |
F8 | 64 | 100 |
F9 | 65 | 101 |
F10 | 6D | 109 |
F11 | 67 | 103 |
F12 | 6F | 111 |
F13 | 69 | 105 |
F14 | 6B | 107 |
F15 | 71 | 113 |
Space | 31 | 49 |
Tab | 30 | 48 |
Home | 73 | 115 |
Backspace | 33 | 51 |
End | 77 | 119 |
Page Up | 74 | 116 |
Page Down | 79 | 121 |
Delete | 75 | 117 |
Help | 72 | 114 |
Left | 7B | 123 |
Right | 7C | 124 |
Up | 7E | 126 |
Down | 7D | 125 |
= | 18 | 24 |
- | 1B | 27 |
[ | 21 | 33 |
] | 1E | 30 |
\ | 2A | 42 |
´ | 32 | 50 |
' | 27 | 39 |
; | 29 | 41 |
/ | 2C | 44 |
, | 2B | 43 |
. | 2F | 47 |
, | 2B | 43 |
On macOS the FileMaker application needs to have permissions to press keys. See system preferences, privacy and accessibility. Make sure FileMaker has a checkmark there.
See virtual key codes for Windows here:
https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
Examples
Press a key
MBS( "RemoteControl.PressKey"; "a")
Press return key on Mac:
MBS( "RemoteControl.PressKey"; 36; 13)
Press cursor right key on Mac:
MBS( "RemoteControl.PressKey"; 124; 0 )
Write Hello
Set Variable [ $r ; Value: MBS("RemoteControl.PressShiftKey"; 1) ]
Set Variable [ $r ; Value: MBS("RemoteControl.PressKey"; "H") ]
Set Variable [ $r ; Value: MBS("RemoteControl.PressShiftKey"; 0) ]
Set Variable [ $r ; Value: MBS("RemoteControl.PressKey"; "e") ]
Set Variable [ $r ; Value: MBS("RemoteControl.PressKey"; "l") ]
Set Variable [ $r ; Value: MBS("RemoteControl.PressKey"; "l") ]
Set Variable [ $r ; Value: MBS("RemoteControl.PressKey"; "o") ]
Press return with plugin looking up codes:
Set Variable [ $r ; Value: MBS("RemoteControl.PressKey"; ¶) ]
Press space key:
Set Variable [ $r ; Value: MBS("RemoteControl.PressKey"; " ") ]
See also
- HotKey.Register
- RemoteControl.PressCommandKey
- RemoteControl.PressControlKey
- RemoteControl.PressKeyLater
- RemoteControl.PressOptionKey
- RemoteControl.PressShiftKey
Release notes
- Version 14.5
- Fixed an edge case with swiss keyboard layout for RemoteControl.PressKey function and the virtual key lookup.
Example Databases
- RemoteControl/Control Windows Calculator
- RemoteControl/Press keys
- Win Only/Search Scripts
- Win Only/Snippets for Windows
Blog Entries
This function checks for a license.
Created 18th August 2014, last changed 23th August 2022
RemoteControl.PressDialogButton.Clear - RemoteControl.PressKeyLater