542.

AppleScript to enable SOCKS proxy on Mac OS X « Blog « Peter Upfold

peter.upfold.org.uk/blog/2008/10/10/applescript-to-enable-socks-proxy-on-mac-os-x

This article helped me set up automated proxy toggling.