• 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: How to get container when overriding NSCreateCommand
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get container when overriding NSCreateCommand


  • Subject: Re: How to get container when overriding NSCreateCommand
  • From: Dustin Voss <email@hidden>
  • Date: Wed, 13 Jul 2005 20:15:33 -0700

On 13 Jul 2005, at 7:32 AM, Bill Cheeseman wrote:

In my scriptable Core Data app, I have successfully overridden
NSCreateCommand so that I can create a new managed object and insert it in
the document's managed object context using AppleScript.


However, I don't know how to get a reference to the managed object's
container (a document), so that I can insert the new managed object into the
correct document as designated in the running script. In my override of
NSCreateCommand, all of the likely methods return nil: - directParameter,
-receiversSpecifier, -evaluatedReceivers.
...
I know the information that I want is in there somewhere, because
+[NSScriptCommand currentCommand] returns a description that includes this
gem: "Container Specifier for created object: <NSIndexspecifier
orderedDocuments 2>". But I don't know how to get the underlying data so
that I can use it programmatically.

If I were to guess (which I am, in fact, about to do), I would guess that, since the make command doesn't appear to have a direct parameter, the container will be in the 'subj' attribute of the Apple Event.


If I am correct, this method for NSScriptCommand should retrieve & evaluate it.

- (id) subjectsSpecifier
{
NSAppleEventDescriptor *subjDesc = [[self appleEvent] attributeDescriptorForKeyword: 'subj'];
NSScriptObjectSpecifier *subjSpec = [NSScriptObjectSpecifier _objectSpecifierFromDescriptor: subjDesc
inCommandConstructionContext: nil];
return [subjSpec objectsByEvaluatingSpecifier];
}


_______________________________________________
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: How to get container when overriding NSCreateCommand
      • From: Bill Cheeseman <email@hidden>
References: 
 >How to get container when overriding NSCreateCommand (From: Bill Cheeseman <email@hidden>)

  • Prev by Date: Re: Core Data/Cocoa Bindings: best practice for using strings in code?
  • Next by Date: Re: 'Touching' managed objects properties.
  • Previous by thread: How to get container when overriding NSCreateCommand
  • Next by thread: Re: How to get container when overriding NSCreateCommand
  • Index(es):
    • Date
    • Thread