Getting current selection of popup menu
Getting current selection of popup menu
- Subject: Getting current selection of popup menu
- From: Kevin <email@hidden>
- Date: Tue, 25 Jan 2005 11:10:42 +1100
Title: Getting current selection of popup
menu
I've trawled the archives, tried as many options as I could find
and, all in all, wrestled with this one line of code for too long!
Please help me!
I want to get the current network location from the Finder's Apple
menu (OS X 10.3.7) and store that as a variable.
For the purpose of illustration, let's say Apple Menu - Location
is currently set to 'Cable'. I want to store 'Cable' as
'varCurrentLocation'.
With thanks in anticipation.
Kevin
tell
application
"Finder" to activate
-- see if the
active application or process is Internet Explorer or
Safari
tell
application
"System Events"
tell process "Finder"
tell menu bar 1
tell menu "Apple"
tell menu item "Location"
tell menu "Location"
--set
(varCurrentLocation) to (title of current menu item)
--set
(varCurrentLocation) to (title of first menu item)
--
set (varCurrentLocation) to (title of current menu item of menu
"Location")
--set
(varCurrentLocation) to (popup menu)
--set
(varCurrentLocation) to (menu item 1 of popup
menu)
--set
(varCurrentLocation) to (popup menu)
display
dialog
("Current Location is " & varCurrentLocation) & ". Choose the
one you want." buttons {"Linksys", "Cable"} giving up after 10
set varLocationChoice to the button returned of
result
if varLocationChoice contains "cable" then
say "Still on cable"
--Don't change Location setting
else
click
menu item
"Home wireless Linksys"
say "Changed to Linksys for Robert!"
end
if
end
tell
end
tell
end
tell
end
tell
end
tell
end
tell
end
run
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden