Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if application "System Preferences" is running then ¬
- do shell script "killall 'System Preferences'"
- repeat until application "System Preferences" is not running
- delay 0.1
- end repeat
- (* Here is an example of why I needed to use
- do shell script "killall 'System Preferences'" instead of tell application "System Preferences" to quit…
- Which won’t work if this "System Preferences" panel and sub menu were open.
- https://i.imgur.com/JnIwUur.png *)
- tell application "System Preferences"
- reveal anchor "keyboardTab" of ¬
- pane id "com.apple.preference.keyboard"
- end tell
- tell application "System Events"
- repeat while not (exists of pop up button 2 of tab group 1 ¬
- of window "Keyboard" of application process "System Preferences")
- delay 0.1
- end repeat
- perform action "AXShowMenu" of pop up button 2 of tab group 1 ¬
- of window "Keyboard" of application process "System Preferences"
- repeat while not (exists of menu item "F1, F2, etc. Keys" of menu 1 ¬
- of pop up button 2 of tab group 1 of window ¬
- "Keyboard" of application process "System Preferences")
- delay 0.1
- end repeat
- click menu item "F1, F2, etc. Keys" of menu 1 of pop up button 2 ¬
- of tab group 1 of window ¬
- "Keyboard" of application process "System Preferences"
- end tell
- tell application "System Preferences" to quit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement