but, as with my previous post, these deal with AppleScript Studio code. I need to know how to do this with AppleScriptObjC.
I believe I’ve got my subclass properly created as T2TObject. I’m just stuck on adding the separator to the end of my popup button (popCatList). “call method” obviously doesn’t work, so how do I do this now in AppleScriptObjC?
popCatList's removeAllItems()
popCatList's addItemWithTitle_("None")
set theSep to current application's NSMenuItem's separatorItem()
popCatList's menu()'s addItem_(theSep)
popCatList's addItemsWithTitles_(catList)
doesn’t work, returning an error: “unrecognized function addItem_. (error -10000)”
I’ve tried a couple different variations of your snippet with no success. I just get “None”, whereas without attempting the separator I get “None” followed by by my list.
“menu” is an AS term, so to use it as a handler call you need to use pipes: |menu|()'s. This sort of thing is a good reason to edit scripts in an external editor rather than Xcode it self.
"The word “menu” is an AppleScript class name. There are a few ASObjC methods that have the same name as an AppleScript keyword, so to use those you need to place the word in pipes, for example: