PDA

View Full Version : system preferences network applescript




mcmary
Jun 5, 2006, 05:57 PM
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
Jun 6, 2006, 06:23 AM
The best solution is to create two network locations with the different settings... then

Looking at this (http://forums.macrumors.com/showthread.php?t=205457) thread.

Then following
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...

mcmary
Jun 6, 2006, 02:21 PM
Hey thats much simpler and it works, thank you!