AppleScript for changing network configurations

I am new to the Apple world as I have been working in a Windows world for the past 13 years.
Tell me. How flexible are Applescripts? Is it possible to change one of your network cards from DHCP to manual and in the same instance assign an IP to the NIC the script initiated as manual?
I’ve run across some other scripting (i.e. vb, perl, windows, shell) that can do that in Windows but I wasn’t sure if Applescripts had the same power.
If anyone knows where I can find such a script or can direct me to the best place to learn how to do it myself, I would be eternally grateful.
Thanks.

Hi,

welcome to the board and to the amazing world of Apple :wink:

OS X allows to define network locations with different settings.
To change the location with AppleScript, use a shell command

 set myLocation to "home"
do shell script "scselect " & myLocation

Thank you.
So, you are saying to setup different profiles with different settings in Network Preferences that hold preferences for manual with the IP address and DHCP and then use the Applescript to change back and forth from one location to the other?
Is that how it’s done?
Thanks again.

Exactly :slight_smile:

Brilliant!
I’m loving OS 10 more and more each day.
Thanks again.

In case you’re interested, Ed, one of the recent MacsScripter unScripted articles is an AppleScript Tutorial on Scripting System Preferences. Among one or two other things, this covers the question of changing the current location in network preferences.

Since the piece is a fairly lengthy one, I should perhaps mention that the relevant references appear under the following headings:

(Alternatively, simply carry out a page search for location.)