I’ve been using Control+F7 to toggle Full Keyboard Access - ‘All Controls’ vs ‘Text Boxes And Lists Only’ (located in Keyboard & Mouse preferences) in my AppleScripts in order do do some GUI scripting for some “non-scriptable” applications. Problem is, sometimes I am actually toggling it OFF instead of ON if for some reason it was already on before running the script. Much mayhem ensues in that situation, I assure you
Is there a way to say something like “Turn Full Keyboard Access All Controls ON” in AppleScript?? This needs to work in 10.3, 10.4, and 10.5.
do shell script "defaults write .GlobalPreferences AppleKeyboardUIMode -int 2" -- all controls
do shell script "defaults write .GlobalPreferences AppleKeyboardUIMode -int 0" -- text boxes and lists only
Sorry to wake this up from the dead but I’m looking for this solution for exactly the same reason as the thread starter and was hoping that there would be some nice shell script for it.
StefanK, running those scripts one at a time, I don’t get an error message nor any other response than “”, but I don’t see the setting changing in the System Preferences window. I’m on Yosemite, maybe those scripts no longer work? Is there a more up to date equivalent to this?
Even if toggling itself wasn’t possible, a method to at least check on its current state would be very helpful because then you can use that information to decide whether or not you want to proceed to emulate the keyboard shortcut that toggles the state.
Edit: Okay great, I was too hasty and the scripts DO still toggle the state! I was just looking at the System Preferences window next to ScriptEditor window expecting to see the change, but nothing happened. I also went back to the main System Preferences window and to the Keyboard tab because in my experience some things that don’t update immediately finally do if you just reload the tab that way. But apparently in this occasion you don’t see the setting until you close System Preferences entirely and relaunch it. Sorry, I’d just never encountered this behavior before in any other context so it really looked like it wasn’t doing anything.
Since that line of script is so short, the act of checking on current state would be more hassle than just giving the command no matter what, so this will do.
Thanks StefanK, still relevant tips!