- Put both scripts in Automator apps
- Set ControlPlane to start (and hide) both apps
- Grant Accessibility permissions to Automator
Created
March 24, 2014 19:36
-
-
Save enplotz/9747447 to your computer and use it in GitHub Desktop.
Activate and Deactivate function keys using AppleScript.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "System Preferences" | |
set current pane to pane "com.apple.preference.keyboard" | |
end tell | |
tell application "System Events" | |
if UI elements enabled then | |
tell tab group 1 of window "Keyboard" of process "System Preferences" | |
set theCheckbox to checkbox "Use all F1, F2, etc. keys as standard function keys" | |
tell theCheckbox | |
if not (its value as boolean) then click theCheckbox | |
end tell | |
end tell | |
else | |
tell application "System Preferences" | |
set current pane ¬ | |
to pane "com.apple.preference.universalaccess" | |
display dialog ¬ | |
"UI element scripting is not enabled. Check \"Enable access for assistive devices\"" | |
end tell | |
end if | |
end tell | |
tell application "System Preferences" | |
quit | |
end tell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "System Preferences" | |
set current pane to pane "com.apple.preference.keyboard" | |
end tell | |
tell application "System Events" | |
if UI elements enabled then | |
tell tab group 1 of window "Keyboard" of process "System Preferences" | |
set theCheckbox to checkbox "Use all F1, F2, etc. keys as standard function keys" | |
tell theCheckbox | |
if (its value as boolean) then click theCheckbox | |
end tell | |
end tell | |
else | |
tell application "System Preferences" | |
set current pane ¬ | |
to pane "com.apple.preference.universalaccess" | |
display dialog ¬ | |
"UI element scripting is not enabled. Check \"Enable access for assistive devices\"" | |
end tell | |
end if | |
end tell | |
tell application "System Preferences" | |
quit | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment