Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Monaj

macrumors regular
Original poster
May 24, 2009
193
0
Hi all,

In our college we all share the iMacs with same user account, say- Anonymous. So when some other user comes and uses my system, he/she generally changes some of the properties in system preferences. It always wastes some of my precious time when I restore its setting according to mine.

So, I am thinking -
can I make an apple script which when executed sets setting in system preferences according to my choices?

Thanks in advance for any help, suggestion or useful link!

Monaj
 
Which settings did you want to change? Be specific.


Most settings for a user can be read or written using the 'defaults' command in Terminal. Since Terminal accepts pasted-in commands, you could keep a simple text file on a USB thumb drive, and paste its contents into a Terminal window to set the settings the way you want.

Some settings are not accessible through 'defaults'. Some use other commands, like 'scutil'. Some require admin privilege, but there is a command for that.
 
Specific Requirements

Which settings did you want to change? Be specific.

thanks, for your reply!

Specifically I want to perform these tasks:

Mouse Preference-
1. Set action for right mouse button to Secondary Button.
2. Set action for scroll ball button to Spaces.
3. Set action for side buttons to Expose - All Windows.
4. Any of above

Expose & Spaces > Spaces Preference-
Set no. of rows to 1 and no. of columns to 3.

Can you suggest me how to achieve my requirements?

Thanks,

Monaj
 
Set the Primary Button to the right button:
Code:
defaults -currentHost write -g \
  "com.apple.mouse.swapLeftRightButton" -int 1

Set the Primary Button to the left button:
Code:
defaults -currentHost write -g \
  "com.apple.mouse.swapLeftRightButton" -int 0

Set Spaces to 1 row, 3 cols, enabled:
Code:
defaults write com.apple.dock "workspaces-cols" -int 3
defaults write com.apple.dock "workspaces-rows" -int 1 
defaults write com.apple.dock "workspaces" -int 1
May not take effect immediately. You may have to logout and login again.


Some other settings not obviously Dock-related are also in com.apple.dock. Hot-corners, for example:
Code:
defaults read com.apple.dock | grep wvous
Google the names it finds and you'll see the relationships.


A number of Exposé and hot-key settings are here:
Code:
defaults read com.apple.symbolichotkeys

The general approach is to redirect output to a file, e.g. 's1'. This establishes the current state. Then go to the System Preferences pane and change a setting. Close the window. Run the command again, redirecting output to a different file, e.g. 's2'. Then find differences:
diff s1 s2

If differences appear, isolate which line they're on, then figure out the 'defaults' command-line to change the setting.

If no differences appear, then the settings isn't stored in that preferences file.


Another command for working with plists is PlistBuddy. Google it.


You might also be able to do GUI Scripting on the pref-pane. For example, see here:
http://www.macosxautomation.com/applescript/uiscripting/index.html

or google keywords: system preferences gui scripting
 
thanks tone for the commands :)

Just one more question... can I do it via any apple script command?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.