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: Can't make ... of <<class >> into type reference



Sorry to self-reply, but I found my problem.

NSScriptClassDescription *containerClassDesc = (NSScriptClassDescription *)
[NSScriptClassDescription classDescriptionForClass:[NSApp class]];
return [[[NSNameSpecifier alloc] initWithContainerClassDescription:containerClassDesc
containerSpecifier:nil key:@"orders"
name:[self pNumber]] autorelease];

You can see I was using my order number (pNumber) in the name: parameter. This did return what appeared to be an OK order object, but if applescript had to go back and reference the order as it did in my example...


set myOrder to first order whose number is orderNumber
	
	customer name of myOrder

...then it couldn't find the order since it used the order number to try to find the order name.


Interestingly, the applescript:
customer name of first scheduled order whose id is orderNumber

...does not even cause the -objectSpecifier method to be called, which it why it always worked, despite the poor form of my code in that method previously.



So what made it work for me was to return the order name in the "name:" parameter in my -objectSpecifier method, but I believe that what I will do is consider to use NSUniqueIDSpecifier with my order number.


I'm in kind of a funny spot because the primary identifier of an order at my company is the production number or order number, which I think best corresponds to the applescript "name" property, but then we also have an order name such as "Cleveland Water Treatment Plant Job" or similar, so I have to make a decision of which of these properties is the best applescript "name" for an order.

Thanks again everybody, I feel I have a much better handle on this.


_______________________________________________ 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: 
 >Can't make ... of <<class >> into type reference (From: Paul Bruneau <email@hidden>)
 >Re: Can't make ... of <<class >> into type reference (From: Mike Glass <email@hidden>)
 >Re: Can't make ... of <<class >> into type reference (From: Paul Bruneau <email@hidden>)
 >Re: Can't make ... of <<class >> into type reference (From: Christiaan Hofman <email@hidden>)
 >Re: Can't make ... of <<class >> into type reference (From: Paul Bruneau <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.