book
  • README
  • cheatsheet
    • bash
      • builtin
      • syntactic sugar
      • cmd
      • havefun
    • text-processing
      • awk
      • sed
      • html
      • json
      • regex
      • unicode
    • osx
    • curl
    • tricky
    • widget
    • proxy
    • colors
    • math
    • media
    • ssl
      • keystore
      • verification
      • server
      • client
      • tricky
    • windows
      • powershell
      • choco
      • wsl
      • wt
      • shortcut
      • clsid
      • env
      • shell:folder
  • vim
    • nvim
    • install
    • color
    • plugins
      • usage
      • other plugins
      • deprecated
    • tricky
    • viml
    • windows
    • troubleshooting
  • devops
    • admin tools
    • ssh
    • git
      • config
      • alias
      • submodule
      • eol
      • example
      • gerrit
        • gerrit API
      • github
      • troubleshooting
      • tricky
      • statistics
    • pre-commit
    • release-tools
    • tmux
      • cheatsheet
    • ansible
    • vault
    • artifactory
      • api
      • cli
      • aql
      • nginx cert
    • klocwork
      • kwadmin
      • kwserver
      • api
      • q&a
    • elk
    • mongodb
    • android
    • mobile
  • jenkins
    • config
      • windows
    • appearance
    • troubleshooting
    • jenkinsfile
      • utility
      • parallel
      • build
      • envvar
      • properties
      • trigger
      • node
    • script
      • job
      • build
      • stage
      • agent
      • security & authorization
      • exception
      • monitor
      • tricky
    • api
      • blueocean
    • cli
    • plugins
      • kubernetes
      • docker
      • shared-libs
      • lockable-resource
      • ansicolor
      • badge
      • groovy-postbuild
      • simple-theme
      • customizable-header
      • artifactory
      • jira-steps
      • job-dsl
      • build-timeline
      • crumbIssuer
      • coverage
      • uno-choice
      • tricky
  • virtualization
    • kubernetes
      • init
        • kubespray
        • kubeadm
          • environment
          • crio v1.30.4
          • docker v1.15.3
          • HA
        • addons
        • etcd
      • kubectl
        • pod
        • deploy
        • replicasets
        • namespace
        • secrets
      • node
      • certificates
      • events
      • kubeconfig
      • kubelet
      • troubleshooting
      • cheatsheet
      • auth
      • api
      • tools
        • monitor
        • helm
        • network
        • minikube
    • docker
      • run & exec
      • voume
      • remove
      • show info
      • dockerfile
      • dockerd
      • tricky
      • troubleshooting
      • windows
    • crio
    • podman
  • ai
    • prompt
  • osx
    • apps
      • init
      • brew
    • defaults
    • system
    • network
    • script
    • tricky
  • linux
    • devenv
    • util
      • time & date
      • output formatting
      • params
      • tricky
    • nutshell
    • disk
    • network
    • troubleshooting
    • system
      • apt/yum/snap
      • authorization
      • apps
      • x11
    • ubuntu
      • systemctl
      • x
    • rpi
  • programming
    • groovy
    • python
      • config
      • basic
      • list
      • pip
      • q&a
    • others
    • archive
      • angular
      • maven
      • mysql
        • installation
        • logs
      • ruby
        • rubyInstallationQ&A
  • tools
    • fonts
    • html & css
    • Jira & Confluence
    • node & npm
      • gitbook
      • hexo
      • github.page
      • code themes
    • app
      • microsoft office
      • vscode
      • virtualbox
      • iterm2
      • browser
      • skype
      • teamviewer
      • others
  • quotes
  • english
Powered by GitBook
On this page
  • apple script
  • key code

Was this helpful?

  1. osx

script

PreviousnetworkNexttricky

Last updated 7 months ago

Was this helpful?

apple script

reference:

  • sample code:

    tell application "System Events"
      key code 124 using {shift down, command down} --> Right arrow
      key code 8 using command down --> ⌘-C
      key code {4, 14, 37, 37, 31, 47} --> H, e, l, l, o, .
    
      keystroke "v" using command down --> ⌘-V
      keystroke "Hello." --> H, e, l, l, o, .
    end tell

key code

[!NOTE|label:references:]

KEY
KEY CODE
KEY
KEY CODE
KEY
KEY CODE

!1

18

"'

39

I

34

@2

19

_-

27

O

31

#3

20

+=

24

P

35

$4

21

<,

43

K

40

%5

23

>.

47

L

37

^6

22

?/

44

Z

6

&7

26

N

45

X

7

*8

28

M

46

C

8

(9

25

Q

12

V

9

)0

29

W

13

B

11

~`

50

E

14

A

0

{[

33

R

15

S

1

}]

30

T

17

D

2

|</code>

42

Y

16

F

3

:;

41

U

32

G

5

H

4

J

38

function keys

KEY
KEY CODE
KEY
KEY CODE
KEY
KEY CODE

␣ space

49

⇥ tab

48

⌫ delete

51

⏎ return

36

⌦ forwarddelete

117

␊ linefeed

52

⎋ esc

53

⌘ command

55

⇧ shift

56

⇪ capslock

57

⌥ option

58

⌃ control

59

⇧ right shift

60

⌥ right option

61

⌃ right control

62

⇱ home

115

⇲ end

119

⇞ page up

116

⇟ page down

121

← left arrow

123

→ right arrow

124

↓ down arrow

125

↑ up arrow

126

-

-

Fn keys

KEY
KEY CODE
KEY
KEY CODE
KEY
KEY CODE

F1

122

F2

120

F3

99

F4

118

F5

96

F6

97

F7

98

F8

100

F9

101

F10

109

F11

103

F12

111

Number pad

KEY
KEY CODE
KEY
KEY CODE
KEY
KEY CODE

1

83

2

84

3

85

4

86

5

87

6

88

7

89

8

91

9

92

0

82

*

67

/

75

+

69

-

78

=

81

.

65

clear

71

-

-

How to automate your keyboard in Mac OS X with AppleScript
AppleScript Command Sendkeys
How can I get rid of this osascript output?
Running a command in a new Mac OS X Terminal window
* Complete list of AppleScript key codes
Key Codes for Function and Special Keys in Applescript