Please see my Alfred Extensions page for updates!
I wrote this little scriptlet to change network location in OS X using Alfred, but you could trigger it using whatever method you wanted.
If you’re using Alfred 0.9.9 or later, you should be able to download this ZIP file and import it!
if you using an earlier version, follow the instructions below:
/usr/sbin/scselect 2>&1 | /usr/bin/grep -i {query} | /usr/bin/cut -c 4-39 | /usr/bin/xargs /usr/sbin/scselect |
UPDATE 2011-06-11: I have significantly improved the script to work around a bug caused by the 3Connect profile (3Connect is pants FYI), as well as use growlnotify to tell you if the change worked or not. It also allows substring matches (anchored at the start) so you can use “auto” for “Automatic”. If you have more than one profile that starts with a matching substring, the behaviour is currently undefined.

MSG=`/usr/sbin/scselect 2>&1 | /usr/bin/egrep -i "\({query}" | /usr/bin/cut -c 4- | /usr/bin/cut -f 1 | /usr/bin/head -n 1 | /usr/bin/xargs /usr/sbin/scselect | /usr/bin/sed -E 's/.+ \((.+)\)/Location changed to \1/'`; if [ "$MSG" = "" ]; then /usr/local/bin/growlnotify -a /System/Library/PreferencePanes/Network.prefPane -m "Unable to change location" Error; else /usr/local/bin/growlnotify -a /System/Library/PreferencePanes/Network.prefPane -m "$MSG" Location changed; fi; |
If you want it without Growl notifications, use this version:
usr/sbin/scselect 2>&1 | /usr/bin/egrep -i "\({query}" | /usr/bin/cut -c 4- | /usr/bin/cut -f 1 | /usr/bin/head -n 1 | /usr/bin/xargs /usr/sbin/scselect |
It’s slightly convoluted as it’s case-insensitive. To use it, create a Terminal/Shell script entry like this:

Now you can just type “location work” or similar into Alfred to change network location. I’ll add Growl-confirmation support when the next version of Alfred is released :)