iPhoto - test if a photo is in a given album

Hi,

I tried different solutions, and looked for answers in the forum, but without success.

I can’t test if a photo belongs to a given album.

For example, the following script gets an error :

tell application "iPhoto"
	set albumTOTO2 to album "TOTO2"
	set theSet to every photo of album "TOTO"
	set unePhoto to item 1 of theSet
	set theTest to (albumTOTO2 contains unePhoto)
end tell

There must be something obvious I’m missing ?

Thanks for your help,
Nicolas

Hi,

you cannot test for

album "abc" contains photo "def"

it must be

every photo of album "abc" contains photo "def"

I recommend to check just for the unique id


tell application "iPhoto"
	set idOfPhotosOfAlbumTOTO2 to id of every photo of album "TOTO2"
	set theSet to id of every photo of album "TOTO"
	set idOfunePhoto to item 1 of theSet
	set theTest to (idOfPhotosOfAlbumTOTO2 contains idOfunePhoto)
end tell

Many thanks Stefan !