Years ago I was looking for an app that could set context-aware preferences on OS X. The only one I could find was MarcoPolo, which has not been updated since 2007. The idea was awesome: You could add contexts (e.g. "work" and "home") and specify trigger rules to determine these contexts. E.g. you can set a switch to the "work" context if the WLAN SSID from work could be reached, etc.
Now I found a fork of this project called ControlPlane. This is exactly what I was looking for to automatically toggle the password for the screensaver and to mute the sound when I arrive at work. A nice Growl message tells you about the context switch and which actions were performed. It is highly configurable and even terminal commands can be executed if you miss a certain action.