Sunday, November 14, 2010

On Mac OS X, how do you switch system preferences settings with AppleScript?

The computers in the computer lab are set to revert every time you log off. I change a number of settings every time I log on: International -%26gt; input menu, add input type Dvorak -%26gt; keyboard shortcuts, enable input menu, disable previous input source, change next input source to 鈱?shift+1 -%26gt; expos茅 and spaces, enable spaces, add row, add column. Isn't it really easy to write an AppleScript that does all that for you in an instant?On Mac OS X, how do you switch system preferences settings with AppleScript?In Leopard, there are several improvements for scripting System Preferences. The link below is some samples from Apple's website.

http://www.apple.com/applescript/feature

I haven't played around with scripting System Prefs yet, but you may only be able to get so far before having to use GUI scripting.

http://www.apple.com/applescript/uiscrip

Depending on the way your IT department set up your macs, you may have to have an administrator password in order to turn GUI scripting on and off.

If you do get into UI scripting there are free and paid tools that can help you.

Oh, and an AppleScript won't change your settings in an ';instant,'; but it will be a lot faster than you doing it manually.On Mac OS X, how do you switch system preferences settings with AppleScript?I don't understand how you manage to change all these settings. Some of them do not take effect until you logout and login again which would automatically revert to the default settings. But if you can do it, great. Maybe their is some special software installed that instigates not only the reverting to default preferences but also allows your preferences to take effect without logout-login.

You could write a script that would change your prefs but it would be much simpler to write a script that would rename your Preferences folder (after you have made your settings) to ';Preferences-old'; or ';Preferences-yourname'; or whatever. For that matter, you could do it manually just before you shutdown. Then, when the computer starts up again, there will be a default Preferences folder created automatically as usual. Then you trash the Preferences folder and rename your Preferences-old to Preferences.