• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: AppleScript: Returning object references in Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AppleScript: Returning object references in Cocoa


  • Subject: Re: AppleScript: Returning object references in Cocoa
  • From: Fritz Anderson <email@hidden>
  • Date: Tue, 24 May 2005 16:26:01 -0500

On 24 May 2005, at 3:21 PM, Bill Cheeseman wrote:

Why are you passing nil to initWithContainerClassDescription:?

Since you pass nil to containerSpecifier:, I assume the object is a child of
the application (the null container). Then you should pass this to
initWithContainerClassDescription: (NSScriptClassDescription *)[NSApp
classDescription].

I passed nil because the sample code in the documentation for NSScriptObjectSpecifier passes nil as the container class description in all cases, including the case of the application container:


  NSScriptObjectSpecifier *spec;
  NSScriptCommand *command;
  spec = [[[NSIndexSpecifier allocWithZone:[self zone]]
        initWithContainerClassDescription:nil containerSpecifier:nil
        key:@"orderedDocuments" index:0] autorelease];
        /* index 0 indicates "front" document */

I'm glad to pass something else, but was without guidance as to what. Given that -classDescription is spec'ed to return only NSClassDescription, and not NSScriptClassDescription, which the specifier initializer calls for, where could I find assurance that [NSApp classDescription] will provide the right object? Is it just that NSScriptClassDescription is documented to be (so far) the only concrete subclass?


Where, in general, would I have found the correct answer to this question?

Trying your suggestion produces the correct behavior, and I am gratefully sailing in open waters once more. Thanks!

    -- F

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: AppleScript: Returning object references in Cocoa
      • From: Bill Cheeseman <email@hidden>
References: 
 >Re: AppleScript: Returning object references in Cocoa (From: Bill Cheeseman <email@hidden>)

  • Prev by Date: Drawing a view onto an image file
  • Next by Date: Re: Drawing a view onto an image file
  • Previous by thread: Re: AppleScript: Returning object references in Cocoa
  • Next by thread: Re: AppleScript: Returning object references in Cocoa
  • Index(es):
    • Date
    • Thread