Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

Mac Keyboard OSA/JXA JavaScript Key Code Reference

These are the key codes for mac keyboard key presses to use with JXA (JavaScript For Automation) scripts and the `.keyCode()`` method

a 0
b 11
c 8
d 2
e 14
f 3
g 5
h 4
i 34
j 38
k 40
l 37
m 46
n 45
o 31
p 35
q 12
r 15
s 1
t 17
u 32
v 9
w 13
x 7
y 16
z 6
Delete 51
Tab 48
Enter 76
Return 36
Escape 53
Shift__Left 75
Shift__Right 60
Funciton 63
Control 59
Option__Left 58
Command 55
Option_Right 61
Control_Right 62
1 18
2 19
3 20
4 21
5 23
6 22
7 26
8 28
9 25
0 29
1__Numpad 83
2__Numpad 84
3__Numpad 85
4__Numpad 86
5__Numpad 87
6__Numpad 88
7__Numpad 89
8__Numpad 91
9__Numpad 92
0__Numpad 82
Left_Arrow 123
Right_Arrow 124
Up_Arrow 126
Down_Arrow 125
Home 115
Page_Up 116
Page_Down 121
End 119
Space 49
(`backtic`) 50
- 27
= 24
[ 33
] 30
\ 42
; 41
' 39
, 43
. 47
/ 44
*__Numpad 67
/__Numpad 75
+__Numpad 69
-__Numpad 78
=__Numpad 81
.__Numpad 65
clear__Numpad 71
F1 122
F2 120
F3 99
F4 118
F5 96
F6 97
F7 98
F8 100
F9 101
F10 109
F11 103
F12 111
F13 105
F14 107
F15 113
F16 106
F17 64
F18 79
F19 80
F20 90
F1__Alt 107
F2__Alt 113
F3__Alt 160
F4__Alt 131