system preferences network applescript

Discussion in 'Mac Programming' started by mcmary, Jun 5, 2006.

  1. macrumors newbie

    Joined:
    Jun 5, 2006
    #1
    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?
     
  2. macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #2
    The best solution is to create two network locations with the different settings... then

    Looking at this thread.

    Then following
    You can switch between the settings...
     
  3. thread starter macrumors newbie

    Joined:
    Jun 5, 2006
    #3
    Hey thats much simpler and it works, thank you!
     

Share This Page