- Wed 03 November 2010
- programming
- Gaige B. Paulsen
This is a note for those of us who might run into this problem. When working on some changes for Cartographica, I ran into some difficulty when using a verb-first command that could take either a list of one type of user-defined object or another type of user-defined object.
The list worked fine (once I realized that it was going to come in as a set of
NSScriptObjectSpecifiers
that needed to be evaluated). However, I couldn't get
the NSScriptCommand
to receive the call for the stand-alone object of a
different type. AppleScript kept complaining that the class in question didn't
respond to that message. Well, mostly right, except that the command, which
was specified elsewhere should have been taking care of that, or so I thought.
If you have an NSScriptCommand
-based command that takes direct parameters, you
need the class to specify that it responds to that message, even if you do so
by adding an empty method descriptor in the responds-to
. If responds-to
isn't
there, it gets blocked up at a higher level.
So, the solution was simply adding an empty responds-to
for the command that
I'd added and then leaving the work to the NSScriptCommand
-derived class.
I hope this saves somebody some time.