-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreate Keyboard Shortcuts.scpt
More file actions
76 lines (68 loc) · 2.07 KB
/
Copy pathCreate Keyboard Shortcuts.scpt
File metadata and controls
76 lines (68 loc) · 2.07 KB
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
(*
Set shortcuts for Wadsworth (Jump to N% for VLC)
Requires Assistive Device access in order to run.
Also requires Wadsworth extensions for VLC or Automator scripts to be installed.
See this link for details:
https://github.com/verbiate/Wadsworth-for-VLC
*)
tell application "System Preferences"
reveal anchor "shortcutsTab" of pane id "com.apple.preference.keyboard"
activate
end tell
tell application "System Events"
tell application process "System Preferences"
--Wait for the window to draw
repeat while not (window 1 exists)
end repeat
tell window 1
--Wait for the elements to draw
repeat while not (rows of table 1 of scroll area 1 of splitter group 1 of tab group 1 exists)
end repeat
--Go through each row of the list on the left and select App Shortcuts
repeat with current_row in (rows of table 1 of scroll area 1 of splitter group 1 of tab group 1)
if value of static text 1 of current_row is equal to "App Shortcuts" then
select current_row
end if
end repeat
set i to 0
repeat while i < 10
log "Index:" & i
--Click the Add (+) button
tell group 1 of tab group 1
set plusAddButton to (first button where its description = "add")
end tell
click plusAddButton
--Wait for the elements to draw
repeat while not (pop up button 1 of sheet 1 exists)
end repeat
--Set the Application to VLC
if i is 0 then
set appPopupMenu to pop up button 1 of sheet 1
tell appPopupMenu
click appPopupMenu
keystroke "vlc"
keystroke return
--This is a buggy technique with this menu, so we introduce a delay to allow the UI to catch up
delay 0.5
end tell
end if
--Set the shortcut for Jump to n%
if i is 0 then
keystroke "Jump to " & i & "%"
else
keystroke "Jump to " & i & "0%"
end if
keystroke tab
key down command
key down option
--key down control
keystroke i
--key up control
key up option
key up command
click button "Add" of sheet 1
set i to i + 1
end repeat
end tell
end tell
end tell