-
Notifications
You must be signed in to change notification settings - Fork 86
/
shortcuts.applescript
119 lines (106 loc) · 5.08 KB
/
shortcuts.applescript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.keyboard"
reveal anchor "shortcutsTab" of pane id "com.apple.preference.keyboard"
-- Incase the window is not opened instantly
delay 1
end tell
tell application "System Events"
tell application process "System Preferences"
tell splitter group 1 of tab group 1 of window "Keyboard"
set selected of row 9 of table 1 of scroll area 1 to true
end tell
-- Click the "Add" button in the window "Keyboard"
click button 1 of group 1 of tab group 1 of window "Keyboard"
-- Choose the Target Application
tell pop up button 1 of sheet 1 of window "Keyboard"
click
tell menu 1
click menu item "Xcode"
end tell
end tell
-- Set the shortcut title
set value of text field 1 of sheet 1 of window "Keyboard" to "Highlight Occurences of Symbol"
-- Move the focus into the "Keyboard Shortcut" text field
keystroke tab
-- The key code of "F11" is 103
key code 103 using {shift down, command down}
-- Confirm and add the shortcut
click button "Add" of sheet 1 of window "Keyboard"
-- Now the application is default to Xcode,
-- so go straight for the remaining shortcuts
click button 1 of group 1 of tab group 1 of window "Keyboard"
set value of text field 1 of sheet 1 of window "Keyboard" to "Highlight Occurences of String"
keystroke tab
key code 111 using {shift down, command down}
click button "Add" of sheet 1 of window "Keyboard"
click button 1 of group 1 of tab group 1 of window "Keyboard"
set value of text field 1 of sheet 1 of window "Keyboard" to "Highlight Regex Matches"
keystroke tab
key code 103 using {control down, option down, shift down, command down}
click button "Add" of sheet 1 of window "Keyboard"
click button 1 of group 1 of tab group 1 of window "Keyboard"
set value of text field 1 of sheet 1 of window "Keyboard" to "Remove Most Recently Added Highlight"
keystroke tab
key code 109 using {shift down, command down}
click button "Add" of sheet 1 of window "Keyboard"
click button 1 of group 1 of tab group 1 of window "Keyboard"
set value of text field 1 of sheet 1 of window "Keyboard" to "Remove All Highlighting"
keystroke tab
key code 101 using {shift down, command down}
click button "Add" of sheet 1 of window "Keyboard"
-- The Methods group
click button 1 of group 1 of tab group 1 of window "Keyboard"
set value of text field 1 of sheet 1 of window "Keyboard" to "Select Methods and Functions"
keystroke tab
key code 46 using {option down, shift down, command down}
click button "Add" of sheet 1 of window "Keyboard"
click button 1 of group 1 of tab group 1 of window "Keyboard"
set value of text field 1 of sheet 1 of window "Keyboard" to "Select Method and Function Signatures"
keystroke tab
key code 46 using {shift down, command down}
click button "Add" of sheet 1 of window "Keyboard"
click button 1 of group 1 of tab group 1 of window "Keyboard"
set value of text field 1 of sheet 1 of window "Keyboard" to "Duplicate Methods and Functions"
keystroke tab
key code 2 using {option down, shift down, command down}
click button "Add" of sheet 1 of window "Keyboard"
click button 1 of group 1 of tab group 1 of window "Keyboard"
set value of text field 1 of sheet 1 of window "Keyboard" to "Copy Method and Function Declarations"
keystroke tab
key code 8 using {option down, shift down, command down}
click button "Add" of sheet 1 of window "Keyboard"
-- The Lines group
click button 1 of group 1 of tab group 1 of window "Keyboard"
set value of text field 1 of sheet 1 of window "Keyboard" to "Cut Lines"
keystroke tab
key code 7 using {shift down, command down}
click button "Add" of sheet 1 of window "Keyboard"
click button 1 of group 1 of tab group 1 of window "Keyboard"
set value of text field 1 of sheet 1 of window "Keyboard" to "Copy Lines"
keystroke tab
key code 8 using {shift down, command down}
click button "Add" of sheet 1 of window "Keyboard"
click button 1 of group 1 of tab group 1 of window "Keyboard"
set value of text field 1 of sheet 1 of window "Keyboard" to "Paste Lines"
keystroke tab
key code 9 using {shift down, command down}
click button "Add" of sheet 1 of window "Keyboard"
click button 1 of group 1 of tab group 1 of window "Keyboard"
set value of text field 1 of sheet 1 of window "Keyboard" to "Paste Lines Without Reindent"
keystroke tab
key code 9 using {option down, shift down, command down}
click button "Add" of sheet 1 of window "Keyboard"
click button 1 of group 1 of tab group 1 of window "Keyboard"
set value of text field 1 of sheet 1 of window "Keyboard" to "Duplicate Lines"
keystroke tab
key code 2 using {shift down, command down}
click button "Add" of sheet 1 of window "Keyboard"
click button 1 of group 1 of tab group 1 of window "Keyboard"
set value of text field 1 of sheet 1 of window "Keyboard" to "Delete Lines"
keystroke tab
key code 37 using {shift down, command down}
click button "Add" of sheet 1 of window "Keyboard"
end tell
end tell
tell application "System Preferences" to quit