Function key hot key?

Discussion in 'Mac Basics and Help' started by ifjake, Nov 7, 2010.

  1. ifjake macrumors 6502a

    Joined:
    Jan 19, 2004
    #1
    So I know how in keyboard preferences to mark the check box that says "Use function keys as standard function keys," but my question is, is there a way to use a hot key to make this swap instead of having to open up system preferences, navigate to the proper pane and tab, and click the box? I have a couple programs where I absolutely need function keys to be function keys, but for general purpose use, I need the function keys to be the spiffy stuff printed on them.

    Ideally I'd love for the system to look at what app was in the foreground (that is, has control of the menu bar) and recognize this app as needing access to function-function keys and make the swap for me, but I don't think this is possible at the moment, and having a hot key to change it would be the next best thing.

    Thanks!
     
  2. dissolve, Nov 7, 2010
    Last edited: Nov 8, 2010

    dissolve macrumors 6502a

    Joined:
    Aug 23, 2009
    #2
    You could write a small script that will do that for you. I know there's third party software that allows you to assign a script to a hotkey (none that are free, to my knowledge).
     
  3. Jolly Jimmy macrumors 65816

    Jolly Jimmy

    Joined:
    Dec 13, 2007
    #3
    I use Spark to run scripts via keyboard shortcuts, and it's free.

    Try running this one :

    Code:
    set panelName to "Keyboard"
    
    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 "System Preferences" to activate -- open System Preferences
    		set visible of process "System Preferences" to false -- hide it
    		tell application "System Preferences" to set current pane to pane "com.apple.preference.keyboard" -- go to keyboard preferences
    		tell application process "System Preferences"
    			get properties
    			try -- try to do the following, assuming System Preferences is in 64-bit mode
    				click radio button "Keyboard" of tab group 1 of window panelName
    				click checkbox "Use all F1, F2, etc. keys as standard function keys" of tab group 1 of window panelName
    			on error -- in case System Pref is open in 32-bit mode
    				set panelName32 to panelName & " (32-bit)"
    				click radio button "Keyboard" of tab group 1 of window panelName32
    				click checkbox "Use all F1, F2, etc. keys as standard function keys" of tab group 1 of window panelName32
    			end try
    		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 tell
     
  4. dissolve macrumors 6502a

    Joined:
    Aug 23, 2009
    #4
    Nice find! OP, follow this guy's advice ;)
     
  5. ifjake thread starter macrumors 6502a

    Joined:
    Jan 19, 2004
    #5
    Wow thanks, I was thinking I'd probably be an AppleScript angle but all my experience with that has resulted in a lot of spent time. That Sparks find is definitely clutch. Thanks so much.
     

Share This Page