UI scripts to toggle between hardware and software function key mappings on Mac OS X

As a Mac user, especially with a Mac laptop, you are probably using your function keys to control brightness, volume, etc. all the time.

However, some applications, such as Eagle or Photoshop, use the function keys to provide very useful shortcuts to frequently used commands.

You can use the "fn" modifier key to get to those commands, but that's not exactly satisfying given that you're trying to save keystrokes by using these shortcuts for frequent commands.

Or, you can toggle the setting in the "Keyboard & Mouse" pane of System Preferences - but that's a far trip each time before and after using such applications. You're also bound to forget about toggling it, which will leave you always wondering if your function keys currently work this way or that.

The attached two AppleScripts use UI Scripting to check or uncheck that "Use all F1, F2, etc. keys as standard function keys" checkbox in System Preferences. Just download and unzip the archive, add the scripts to your Dock, and they should turn software function keys on or off with a single click. The first script checks the corresponding box, the second unchecks it. The icons should help you to tell them apart. They both verify the checkbox' status beforehand to make sure they always check or uncheck the box no matter what it was before. UI scripting requires Assistive Devices Support to be turned on; the scripts check for that as well, and open the corresponding Universal Access pane if it's not on so you can fix it (obviously they can't set it themselves in this case, haha).

Caveats: These work under Mac OS X 10.5 (Leopard) in US English. UI scripting sometimes has to rely on matching literal strings in the user interface, so these scripts are likely to break in the next OS release, and sure to break in different UI languages (although fixing them should be easy enough).

--Jan Borchers

Created by borchers. Last Modification: Saturday 02 of August, 2008 18:59:11 by borchers.

Media Computing Group at RWTH Aachen