Hey there everyone. I ran into kind of a problem that I do not understand. I tried implementing an fn toggle script, which is working from apple script on my system but not through alfred, which is kind of dissapointing. Anyway I posted it here, so maybe someone can give me some clue. I had to translate the menu items to german in order for it to work...
Edit: found the problem in the last line.
on alfred_script(q)
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 "UI element scripting is not enabled. Please activate \"Enable access for assistive devices\""
end tell
end if
end tellend alfred_script