Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A better way to activate menu items from AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A better way to activate menu items from AppleScript
Authored by: coolsoldier on Sep 29, '06 03:12:55PM

It doesn't use this function, but I script the "Login Window" item this way:


tell application "System Events"
	tell process "SystemUIServer"
		tell menu bar 1
			set menuExtras to (value of attribute "AXChildren")
			tell menuExtras
				set userExtra to (first item whose (value of attribute "AXDescription") contains "user")
			end tell
			tell (userExtra)
				perform action "AXPress"
			end tell
			tell (userExtra)
				tell menu 1
					click menu item "Login Window…"
				end tell
			end tell
		end tell
	end tell
end tell

This should work if you are using 10.4.x, use English as your system language, and have the FUS menu displayed in the menu bar. It works for me, at any rate.



[ Reply to This | # ]