Hello,
My application displays an icon in the menu bar…
set itemOpenWindow to current application's NSMenuItem's alloc()'s init()
tell itemOpenWindow to setTitle_("Open window")
tell itemOpenWindow to setAction_("menubarOpenWindow:")
set itemSeparator to current application's NSMenuItem's separatorItem()
set itemQuit to current application's NSMenuItem's alloc()'s init()
tell itemQuit to setTitle_("Quit")
tell itemQuit to setAction_("menubarQuitApp:")
set itemsMenuBar to current application's NSMenu's alloc()'s init()
tell itemsMenuBar to addItem_(itemOpenWindow)
tell itemsMenuBar to addItem_(itemSeparator)
tell itemsMenuBar to addItem_(itemQuit)
set statusBar to current application's NSStatusBar's systemStatusBar()
set theItem to statusBar's statusItemWithLength:(current application's NSVariableStatusItemLength)
set imageMenuBar to current application's NSImage's imageNamed:"IconMenuBar"
tell theItem to setImage:imageMenuBar
tell theItem to setHighlightMode_(true)
tell theItem to setMenu_(itemsMenuBar)
I don’t find how to hide the icon without relaunch the application. Is it possible ?
Thanks!