• 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: Cocoa Apple Script Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa Apple Script Problem


  • Subject: Re: Cocoa Apple Script Problem
  • From: <email@hidden>
  • Date: Fri, 19 Dec 2008 14:20:47 -0800

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@hidden> 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@hidden)

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:

This email sent to email@hidden

References: 
 >Cocoa Apple Script Problem (From: John Nairn <email@hidden>)

  • Prev by Date: Re: Determining width of a cell in an NSOutlineView
  • Next by Date: Re: Determining width of a cell in an NSOutlineView
  • Previous by thread: Cocoa Apple Script Problem
  • Next by thread: Re: Cocoa Apple Script Problem
  • Index(es):
    • Date
    • Thread