Reputation: 1741
I'm talking about the icons that show up on the right hand side of the menu bar. I can get access to that menu bar with (py-appscript)
app(u'System Events').processes[u'SystemUIServer'].menu_bars[1]
& menu_bar_item[1], menu_bar_items[1] & so on refer to each of the icons.
But, there are couple of icons up there that cannot be referenced using this method. For e.g. the search icon in the corner doesn't belong to SystemUIServer. Similarly, our app's icon also shows up there but cannot be referenced like the above example. So how can I reference those icons? I want to perform actions like click, right-click etc. IS there any way to list all the icons displayed on the bar? That way I can always grab the position & click them that way. Any suggestions?
Upvotes: 1
Views: 756
Reputation: 818
Easiest way to script the spotlight menu is to just send the keys via GUI scripting. I don't think it can be accessed in the fashion you want. As for why your icon won't list I'm not sure. Does it have a menu associated with it?
It's easy to list all the menulings. Here's a Python script to do so. You can then use that data to access them directly with Appscript.
http://www.libertypages.com/clarktech/?p=2193
Upvotes: 1