I think you can do this by just using the ASOC adjusted name for your C method. I created an Objective C method in a new class called AttachedAlert that was defined as this:
None of the above worked is the OBJC action incorrectly written? It originally was an awakefromnib but instead I wanted it to happen in OBJC when the applescript told it to do so. So i changed it to the (void)displaymenubaritem
The correct form is menubarcontroller’s displaymenubaritem(), although you can probably drop the parens. But that’s not your problem – it looks like you’re trying to call an instance method on a class rather than an instance.
2010-04-27 21:17:50.075 InstaPlay 11[14665:a0f] +[Menulet displaymenubaritem]: unrecognized selector sent to class 0x100002220
2010-04-27 21:17:50.077 InstaPlay 11[14665:a0f] *** -[Others changeappstate:]: +[Menulet displaymenubaritem]: unrecognized selector sent to class 0x100002220 (error -10000)
how exactly would i rewrite the:
-(void)displaymenubaritem {
}
Theoretically, you just change the leading - to a +. But it might not be that simple – if the handler uses properties of the Menulet class, it won’t run as a class method anyhow.
So you may be better to make an instance of the class, and call the method on that. You make the instance in IB by dragging in an NSObject blue cube, then changing its class to Menulet. Then change:
property menubarcontroller : class "Menulet"
to:
property menubarcontroller : missing value
Finally, in IB connect the Menulet instance to the property menubarcontroller.