[Pythonmac-SIG] appscript + iPhoto problem

gabor gabor at nekomancer.net
Wed Jul 13 11:16:45 CEST 2005


Gábor Farkas wrote:
> hi,
> 
> what i want to achieve is the following.
> 
> i want to find a photo in iphoto (i can do that),
> and then assign some keywords to it.
> 
> i can find the photo with:
> 
> iphoto = appscript.app('iPhoto')
> photos = iphoto.photos()
> 
> and then i find my photo in 'photos'.
> 
> and i can also list it's keywords.
> but how should i SET the keywords?
> 
> i tried to call the 'help()' method on those objects,
> but all i get are properties, and i can't find a way to set them.
> 
ok, now i know more ;)

i can use:

iphoto = appscript.app('iPhoto')
photos = iphoto.photos.get()
photo = photos[0]
photo.title.set('newTitle')

and this works.

my other problem now is the keywords...

which seems to be an array... how do you work with an array-property in 
appscript?

i tried to simply get it's keywords, append a new keyword to the array, 
and set it, but it did not work:

keys = photo.keywords.get()
allkeys = iphoto.keywords.get()
lastkey = allkeys[-1]

keys.append(lastkey)
photo.keywords.set(keys)

i get an "Application error 8 (NSInternalScriptError)"

:(

gabor





More information about the Pythonmac-SIG mailing list