Showing posts with label gui. Show all posts
Showing posts with label gui. Show all posts

Sunday, July 15, 2007

Applescript to change Network Location

I have the need to change my network location from time to time. Opening the preference pane and making the change is tedious. Below is the applescript that I invoke from Quicksilver to change this. I'm still not sold on the language but being able to script the UI is fantastic.

tell application "System Events"
tell application "System Preferences"
activate
reveal anchor "Network" of pane id "com.apple.preference.network"
end tell

tell window "Network" of process "System Preferences"
tell pop up button 1
click
pick menu item "Home" of menu 1
end tell
delay 1
click button "Apply Now"
end tell

quit application "System Preferences"
end tell