Re: Scripting the Location
Re: Scripting the Location
- Subject: Re: Scripting the Location
- From: Craig Sutherland <email@hidden>
- Date: Fri, 29 Aug 2003 07:56:44 -0500
Irwin-
The Finder only presents the Locations interface. It is System
Preferences that is the underlying application.
tell application "System Preferences" to activate
tell application "System Events"
tell process "System Preferences"
click menu item "Network" of menu "View" of menu bar 1
delay 4 --It takes a bit before System Preferences is loaded
tell pop up button 1 of window "Network" --Location popup
set currentNet to value as string --puts current network in a
variable
---you need to change this line to reflect
your locations-
display dialog "Current Aiport Connection is " & currentNet & ".
Choose the one you want." buttons {"Automatic", "Office"}
set netReturned to the button returned of result
if netReturned is equal to currentNet then --puts clicked button in
a variable --quits pref pane because no current network does need
not to be changed
tell menu 2 of menu bar 1
click menu item 9
end tell --exit script
return --you will need to change the following to reflect
your Location names
else
if netReturned is equal to "Automatic" then
click
tell menu 1
delay 1
click menu item "Automatic"
end tell --menu1
else
click
tell menu 1
delay 1
click menu item "Office"
end tell --menu 1
end if
end if
end tell --pop up button 1
click button "Apply Now" of window "Network" --clicks the Apply Now
button
tell menu 2 of menu bar 1
click menu item 9 --Quit Sys Prefs
end tell --menu 2
end tell --System Preferences
end tell --System Events
HTH
Craig
On Thursday, August 28, 2003, at 05:48 PM, Irwin Poche wrote:
I9m having problems scripting the Location. The script below will work
sometimes. Sometimes it does not. When it doesn9t, UI Browser
doesn't show
any choices for Location.
tell application "Finder" to activate
tell application "System Events"
tell process "Finder"
click menu item "Home" of menu "Location" of menu item
"Location" of menu "Apple" of menu bar 1
end tell
end tell
A similar problem with trying to set Location in the Network Pane of
Systems
Preferences. I can get the value of popup 2 (which has Locations) but
I
cannot set it.
Are these 3beta2 issues or does someone have an alternate method ?
Thanks,
-Irwin
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.