Mac system preferences network applescript

mcmary

macrumors newbie
Original poster
Jun 5, 2006
2
0
This script to toggle network settings from 100full to 10half used to work on our panther G5s. Recently we upgraded to Tiger and it doesn't work anymore.
Here is the script:

tell application "System Preferences" to set current pane to pane "com.apple.preference.network"
tell application "System Events" to tell process "System Preferences" to tell window "Network"
click pop up button 2
click menu item "Built-in Ethernet" of menu of pop up button 2
delay 2
click radio button "Ethernet" of tab group 1 of group 1
delay 2
click pop up button 1 of group 1 of group 1 of tab group 1 of group 1
if value of pop up button 1 of group 1 of group 1 of tab group 1 of group 1 is "100baseTX" then
click menu item "10baseT/UTP" of menu 1 of pop up button 1 of group 1 of group 1 of tab group 1 of group 1
else
click menu item "100baseTX" of menu 1 of pop up button 1 of group 1 of group 1 of tab group 1 of group 1
end if
delay 2
click button "Apply Now" -- wait 6 seconds
end tell
tell application "System Preferences" to quit

The person who wrote it is no longer here. Can anyone help?
 

Eraserhead

macrumors G4
Nov 3, 2005
10,410
10,603
UK
The best solution is to create two network locations with the different settings... then

Looking at this thread.

Then following
stevietheb said:
googling around I found this command:

do shell script "scselect <location>"


So, doing this: do shell script "scselect Automatic" appears to work.
You can switch between the settings...