Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mysterious nulls in NSScriptCommand




On 6 Nov 2007, at 9:17 PM, Major Domo wrote:

On Nov 6, 2007, at 11:52 AM, Daniel Jalkut wrote:

It sounds like you're in the unenviable zone of "something's messed in your sdef." 

If I had to guess, I guess it's trying to evaluate the "set" command (implemented by NSSetCommand), but somehow it's gotten the notion that a different cocoa class (empty string?) has been configured as the handler for that type. 

Daniel

The ways of AppleScript remain dark and mysterious. After implementing add <object> to <container> and remove <object> from <container> I noticed that if <object> was a singular medium, it would ignore the implementation class named for the command and only call the implementation method for medium's respond-to. However, if <object> was a plural (i.e. list of) media it would only call the class and not the method.

To put it another way:
tell libraryDocument to add someMedium to someShelf
calls:
someMedium -implementationMethod: 

while:
tell libraryDocument to add someMedia to someShelf
calls:
ImplementationScriptCommand -performDefaultImplementation

I kind of expected one or the other to be called on the object receiving the tell, but in fact, not only is that not the case, I can't figure out a way to figure out who received the tell at all. I had thought:
tell someShelf to add someMedium
would be a good alternate form, but I could see no way to get someShelf out of the resulting NSScriptCommand.

Mike Lee, Major-domo
Delicious Monster Software, LLC

It's very simple: the direct parameter of the command receives the command. In the first case, this is a medium. As it implements it's own specialized handler, that handler is called. In the second case, it is an array. The array does not implement a specialized handler, so the generic handler is called (performDefaultImplementation). The tell block here is not relevant (apart from giving a context for the medium and the shelf) because you have supplied an explicit direct parameter (otherwise the subject of the tell block would be implicitly substituted). 

I advice you to carefully read the documentation about script command handlers.

Christiaan

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-implementors mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-implementors/email@hidden

This email sent to email@hidden

References: 
 >Mysterious nulls in NSScriptCommand (From: Major Domo <email@hidden>)
 >Re: Mysterious nulls in NSScriptCommand (From: Daniel Jalkut <email@hidden>)
 >Re: Mysterious nulls in NSScriptCommand (From: Major Domo <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.