Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

AppleScript, Network preferences help

Hey Guys

I'm new to applescript and I want to create a script that will change my network settings to a very specific set of settings.

Configure IPv4=Manually
IPv4 Adress=10.60.48.90
Subnet Mask=255.255.248.0
Router=10.60.48.73
Configure IPv6=Automatically

Can anyone give me some tips on how to achieve this in apple script?

Macbook, Mac OS X (10.6.3)

Posted on Aug 8, 2010 7:07 PM

Reply
Question marked as Best reply

Posted on Aug 8, 2010 8:43 PM

The easiest way to do this is to create a new Location in System Preferences -> Network.

Configure this location with your specific IP address requirements, then you can just switch locations to activate the appropriate settings, either via the Apple -> Location menu, or via a simple shell command that you can call via AppleScript, like:

do shell script "scselect Location_Name"


(where Location_Name is the name you gave to the Location in System Preferences.)

Clearly you could have another script revert to your original settings by just substituting the appropriate location name. If you're adventurous you could even have the script prompt the user to select which Location setting to use or, even more advanced, have the script check which config is in use and switch to the other automatically.
2 replies
Question marked as Best reply

Aug 8, 2010 8:43 PM in response to Ausmg15

The easiest way to do this is to create a new Location in System Preferences -> Network.

Configure this location with your specific IP address requirements, then you can just switch locations to activate the appropriate settings, either via the Apple -> Location menu, or via a simple shell command that you can call via AppleScript, like:

do shell script "scselect Location_Name"


(where Location_Name is the name you gave to the Location in System Preferences.)

Clearly you could have another script revert to your original settings by just substituting the appropriate location name. If you're adventurous you could even have the script prompt the user to select which Location setting to use or, even more advanced, have the script check which config is in use and switch to the other automatically.

AppleScript, Network preferences help

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.