Applescripting the Network Preference Pane

February 21, 2005

OK – here’s a nugget of information that I’ve had to search for twice now, so here I’m going to preserve it for a while.

The problem I was trying to solve was using Applescript to change the network in OS X – the path I initially took was to try GUI scripting the Network Preference Pane, but it is problematic, tricky and just plain difficult to get working. Not to mention inelegant and prone to breaking.

Eventually I stumbled across the answer – try doing it from the command line instead! The command to use is ‘scselect’ as told by John Welch on the Applescript Users mailing list one of Apple’s mailing lists.

So you would use the command ‘do shell script’ to use the ‘scselect’ utility from Applescript.