Jump to content

Toggle Fn Key Workflow Not Working anymore


Recommended Posts

http://www.alfredforum.com/topic/1849-toggle-fn-key-behavior/?p=9730

 

I've been using this workflow for a while to easily toggle my fn key behavior for video games, but the workflow doesn't seem working since I updated to Alfred 2.8.1

 

This is what the script looks like:

 

on alfred_script(q)
 
tell application "System Preferences"
    set current pane to pane id "com.apple.preference.keyboard"
    tell application "System Events"
        tell process "System Preferences"
            click checkbox "Use all F1, F2, etc. keys as standard function keys" of tab group 1 of window "Keyboard"
        end tell
    end tell
    quit
end tell
 
end alfred_script
 
Any help is appreciated!
Link to comment
  • 2 months later...

Using OS X 10.11.13 and have included code below that works for me:

 

on alfred_script(q)


tell application "System Preferences"
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 "Keyboard" of tab group 1 of window "Keyboard"
click checkbox "Use all F1, F2, etc. keys as standard function keys" of tab group 1 of window "Keyboard"
set messageToShow to "Function keys set to "
if (value of checkbox "Use all F1, F2, etc. keys as standard function keys" of tab group 1 of window "Keyboard") as boolean then
set messageToShow to messageToShow & "standard function keys."
else
set messageToShow to messageToShow & "media/hardware controls."
end if


display notification messageToShow
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.security"
display dialog "UI element scripting is not enabled. Please activate this app under Privacy -> Accessibility so it can access the settings it needs."
end tell
end if
end tell 


end alfred_script

Hope it works for you as well, good luck!

 

Best,

Tudor

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...