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
MBS( "RemoteControl.PressKey"; VirtualKey; ScanCode { ; down } )   More

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:

KeyHex KeyCodeDecimal KeyCode
a000
b0B11
c088
d022
e0E14
f033
g055
h044
i2234
j2638
k2840
l2537
m2E46
n2D45
o1F31
p2335
q0C12
r0F15
s011
t1117
u2032
v099
w0D13
x077
y1016
z066
05282
15383
25484
35585
45686
55787
65888
75989
85B91
95C92
F17A122
F278120
F36399
F476118
F56096
F66197
F76298
F864100
F965101
F106D109
F1167103
F126F111
F1369105
F146B107
F1571113
Space3149
Tab3048
Home73115
Backspace3351
End77119
Page Up74116
Page Down79121
Delete75117
Help72114
Left7B123
Right7C124
Up7E126
Down7D125
=1824
-1B27
[2133
]1E30
\2A42
´3250
'2739
;2941
/2C44
,2B43
.2F47
,2B43

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

Release notes

  • Version 14.5
    • Fixed an edge case with swiss keyboard layout for RemoteControl.PressKey function and the virtual key lookup.

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 23th August 2022


RemoteControl.PressDialogButton.Clear - RemoteControl.PressKeyLater