1

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?

TheMaster
  • 45,448
  • 6
  • 62
  • 85
John
  • 1,681
  • 3
  • 20
  • 28

1 Answers1

1

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

Clark
  • 833
  • 4
  • 6
  • Never knew that the icons up there are called menulings. Any way, yes, my icon has menu associated with it. And the script that you linked to pretty much did what I was doing. So looks like I either have to resort to GUI scripting or may be I'll poke around a little more & find out why the icon doesn't show up when you list all the menulings. – John Apr 22 '11 at 22:59