Call Method

I’ve been having a problem with assigning submenus to variables in AS Studio simply by adding an “awake from nib” action and then testing for the name and, if it matches, assigning the variable. So I decided to try and do it through an Obj-C class which seems more reliable.

What I’ve done is created two IBOutlets for the menus in my custom NSObject class and then in IB, connected the desired submenus to the outlets. When I compile my project, on the “awakeFromNib” call in the custom class, the two menus are assigned to the outlets. Later, however, when I call the class to simply return those assigned outlets, the class says they are not allocated and returns nil.

I have a sample project showing all of this. The project can be found here: GetIBOutlets.hqx. This project doesn’t do anything but create a log of what is going on, testing if the menus are allocated, and if they are passed to the AppleScript when called.

If anyone can take a look at this and get the custom class to return the proper values when called from the AppleScript, I’d be greatly indebted.

Jon