How to write Applescript for Menulet/Menu extras

Hi all,

I was trying to write script for Menulets but i was unsuccessful. I am using the UI browser but atil all my efforts are futile. For an app like Quicksilver how can i write scripts which simulates the user clicking on it and select from its drop down.

please help. Thank’s in advance

Hi,

the parent process for the menulets is SystemUIServer.

For example, this changes a space in Spaces


property favouriteSpace : 3

tell application "System Events"
	tell process "SystemUIServer"
		tell (1st menu bar item of menu bar 1 whose value of attribute "AXDescription" is "spaces menu extra")
			perform action "AXPress"
			delay 0.2
			perform action "AXPress" of menu item favouriteSpace of menu 1
		end tell
	end tell
end tell

Thanks a lot stefan for your replies … i must say you are truly amazing.

I agree with you that parent process of menulet is SystemUIServer but these are only OSX specific menulets. Incase you create your own menulet for example application Quicksilver’s menulet —> the parent process of which will not be SystemUIServer.

Hi

You can use this to access the Menulets but the snag is it would differ more than likely from
mac to mac.

tell application "System Events"
	tell application process "Finder"
		try
			keystroke (key code 100 using control down)
		end try
	end tell
end tell

You would obviously need to add the Keystrokes for the arrow keys to find the menulet or the menu of the choosen menulet.

it’s all a bit messy for my liking but can be done.

thanks but that din’t work either. Is there any other way ?