Hi John-

If you are on Leopard, try taking a look at the documentation for the
following method:

- (id)newScriptingObjectOfClass:(Class)class forValueForKey:(NSString *)key
withContentsValue:(id)contentsValue properties:(NSDictionary *)properties;

The Cocoa Scripting Guide refers to the Leopard Foundation Release Notes in
a number of places for the latest info, and that I where I found out about
this method
(http://developer.apple.com/releasenotes/Cocoa/Foundation.html#Scripting). 
In short, one implements this method on the containing object, which then
allows you to read the properties dictionary and configure your newly made
object before it gets added (via insertObject:in<Key>AtIndex:) to the
container object.

There is a lot of new scripting material in those release notes; should be
helpful to your scripting efforts.  Hope this helps!

John

Positive Spin Media
http://www.positivespinmedia.com

On Fri, 19 Dec 2008 10:11:19 -0800, John Nairn <[email protected]> wrote:
> I have implemented the required methods to support creating an object  
> in Apple Script, but it does not work as advertised.
> 
> This does work as expected
> 
>       tell front document
>               make new family at end
>               tell last family
>                       set properties to {husband:"@I5@"}
>               end tell
>       end tell
> 
> This creates the object but does NOT set the properties
> 
>       tell front document
>               make new family at end with properties {husband:"@I5@"}
>       end tell
> 
> The family objects are tied to key-value methods using <key> =  
> famRecords in my suite and the method getting called by both these  
> make commands is
> 
> - (void)insertInFamRecords:(id)object
> 
> where object is the correct FAMRecord type. If "set properties to"  
> works on an existing object, shouldn't it work when creating a new  
> one? Do have to manuul find a way to override the make command?
> 
> Curiously this method of form insertIn<Key>Records: is not even  
> mentioned in the "Key-Value Coding and Cocoa Scripting" section of  
> the "Cocoa Scripting Guide." I had to find it by an error message in  
> the Console before it was present.
> 
> ---------------
> John Nairn
> GEDitCOM - Genealogy Software for the Macintosh
> http://www.geditcom.com


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to