G’ day everyone,
I am trying to hide or “kill” the menu item in the menu bar with a script. Here is my script to make the menu item…
on awakeFromNib()
set statusItem to current application's NSStatusBar's systemStatusBar's statusItemWithLength_(current application's NSSquareStatusItemLength)
statusItem's setTitle_("") -- ⌘ ⇠✖ ⢠➤
statusItem's setMenu_(statusMenu)
statusItem's setHighlightMode_(true)
set myBundle to current application's NSBundle's mainBundle()
set myIcon to current application's NSImage's alloc's initWithContentsOfFile_(myBundle's pathForResource_ofType_("Menu_Icon", "png"))
statusItem's setImage_(myIcon)
end awakeFromNib
I’ve tried to hide a menu item through this code:
statusItem's setHidden_(true)
but I get this error:
[XYZAppDelegate hideMenuItem:]: -[NSStatusItem setHidden:]: unrecognized selector sent to instance 0x4009940c0 (error -10000)