Re: How to get container when overriding NSCreateCommand
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