The "scselect" command will display all the registered locations from the command prompt. If you pass the scselect command a location name then it will change the location to that name. For example if I wanted to set the network location to "Home", I would do the following at the command prompt:
scselect 'Home'
So with that being known I then approached the applet so that it would pull a current list of locations, present them to the user, and then allow the user to change it. The following code can be compiled and run with AppleScript. If you want to make it into an applet then do a "Save As" and change it's type from "Script" to "Application".
UPDATE
I didn't like the fact that a user could choose to switch to their current location so I modify the script to remove it as a choice. I also added credits to where I found examples of this work.
[font="Courier New"]
-- Network Switch
-- Carlos Randolph
-- February 22, 2011
-- OS X 10.6.6
-- I wrote this script to provide an easy way for my wife
-- to switch network locations without having to remember
-- where to do it in System Preferences.
-- Copyright: there is none, do what you want with it, use at your own risk
-- version 1.0 - 10/22/2011 - initial release
-- version 1.5 - 10/23/2011 - doesn't display current location as a choice
-- macscripter.net - remove item from list logic
-- http://macscripter.net/viewtopic.php?id=24525
--
-- www.geekology.co.za - examples of scselect command and how to shell out
-- Willem van Zyl
-- http://www.geekology.co.za/blog/2009/02/change-os-x-network-location-from-command-line-or-applescript-application/
tell application "System Events"
tell network preferences
-- get the current network lcoation
set activeLocation to the name of current location
-- get all network locations and add Quit to the list
set allLocations to the name of every location
copy "Quit" to the end of allLocations
-- remove the current location from the list
set deleteFromList to {activeLocation}
set changeLocations to {}
repeat with i from 1 to count allLocations
if {allLocations's item i} is not in deleteFromList then
set changeLocations's end to allLocations's item i
end if
end repeat
-- display a dialog for the user to choose which network to switch to
set choiceLocation to the button returned of (display dialog "Choose a Network Location" buttons changeLocations default button "Quit")
-- if they quit then skip
if (text of choiceLocation) = "Quit" then
display dialog "You chose to Quit" buttons {"OK"} default button 1
else
do shell script "scselect '" & (text of choiceLocation) & "'"
display dialog "Changed network to " & (text of choiceLocation) & "." buttons {"OK"} default button 1
end if
end tell
end tell[/font]

Help



