Menu bar probe results omit clock etc...

Hey everyone,

I’m trying to put together a script for Adium… and it’s success depends on knowing whether the Status menu bar item is enabled or not.

When using an altered version of apple’s Probe Menubar:

tell application "System Events"
	get properties
	get every process
	if UI elements enabled then
		tell process "Adium"
			get every menu bar
			tell menu bar 1
				get every menu bar item
				get every menu of every menu bar item
			end tell
		end tell
		tell application "System Preferences"
			set current pane to pane ""
			display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
		end tell
	end if
end tell

The results of this operation end at the “Help” Menu… and don’t indicate if the status menubar item is present or not.

How do I go about probing the Clock-side of the menubar, or if you know how to reference the status item directly, any help would be so much appreciated. Thanks for your time and help.


Hi bcode,

welcome to MacScripter :slight_smile:

the status menu items belong to SystemUIServer, look at this thread

Hi Stefan,

Thanks for your quick reply, I’ve been trying to get this script to work for sometime now, and to have some assistance is very much appreciated.

I have read the post you directed me toward but am still having issues trying to identify each menu and it’s menu items. I am very new to applescript and obviously have a lot to learn :slight_smile: This is the code I’m trying to use:

tell application "System Events"
	tell process "SystemUIServer"
		repeat with mbi in menu bar items of menu bar 1
			get value of attribute of mbi as string
		end repeat
	end tell
end tell

But this only returns:
“AXMenuBarItemmenu extraAXMenuExtraclock menu extra”

I’m very confused as to where to go from here. Any help, again, would be great.



scripting the SystemUIServer menu bar items is quite tricky
with this script you get a list of all available items, unfortunately some (real) items are displayed as missing value

tell application "System Events"
	get value of attribute "AXDescription" of menu bar items of menu bar 1 of process "SystemUIServer"
end tell

Thanks again Stefan,

I’m getting very close to where I need to be… it’s great to finally see the light on the horizon. I’m curious, are there attributes other than AXDescription? Do you know where I would find a list of these? Thanks again.


A major part of developing scripts is trial and error :wink:

Use an UI element browser like Prefab’s UIBrowser or Apple’s free UIElementInspector
or just do investigations like this:

tell application "System Events"
	get name of attributes of menu bar items of menu bar 1 of process "SystemUIServer"
end tell

Hi Stefan,

I’ve been learning a lot these last few days, and the UI inspector that you showed me helped tremendously, thanks very much.

I’ve found a few inconsistencies in how Adium treats windows and have had to revise my approach. I’m pretty sure I’ve got er nailed, but I am having one last issue with AS. I am trying to evaluated the following:

set theList to {"", "Contacts", "Accounts", "General", "Personal", "Appearance", "Meassages", "Status", "Events", "File Transfer", "Advanced"}
tell application "Adium"
	get bounds of every window where name is not equal to every item of theList
end tell

This, unfortunately, returns all the windows including the ones specified in theList :frowning:

I could do it this way:

tell application "Adium"
	get bounds of every window where name is not equal to "Accounts" and name is not equal to "Contacts" and etc....
end tell

But it’s sloppy and bad coding and I’m pretty sure is very inefficient. Any ideas on how to compare one word to a whole list and find out if it doesn’t match?? haha, convoluted I know, but it’s only consistent approach I can find.

Thanks again for all your help.


	get bounds of (every window whose name is in theList)

Hi Eelco,

Thanks for your reply, I gave that a try it errors out with:

This script has turned out to be more complex than I could have ever guessed… but I’m dedicated to getting er workin :slight_smile: