Skip to content

Instantly share code, notes, and snippets.

@sofakartoffel
Created March 15, 2013 22:51
Show Gist options
  • Save sofakartoffel/5173767 to your computer and use it in GitHub Desktop.
Save sofakartoffel/5173767 to your computer and use it in GitHub Desktop.
change the behavior of function keys (F1, F2, ...)
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.keyboard"
end tell
tell application "System Events"
-- If we don't have UI Elements enabled, then nothing is really going to work.
if UI elements enabled then
tell application process "System Preferences"
get properties
click radio button "Tastatur" of tab group 1 of window "Tastatur"
click checkbox "Die Tasten F1, F2 usw. als Standard-Funktionstasten verwenden" of tab group 1 of window "Tastatur"
end tell
tell application "System Preferences" to quit
else
-- GUI scripting not enabled. Display an alert
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.universalaccess"
display dialog "Bitte \"Zugriff für Hilfsgeräte aktivieren\""
end tell
end if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment