• 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: Select photos whose name is in list of names?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Select photos whose name is in list of names?


  • Subject: Re: Select photos whose name is in list of names?
  • From: Axel Luttgens <email@hidden>
  • Date: Wed, 24 Dec 2008 12:57:42 +0100

Le 23 déc. 08 à 21:56, Dalmazio Brisinda a écrit :

Hi everyone,

I'm having some problems getting iPhoto to select all photos in an album whose names are contained in a given list. Here's the script which I would have thought should work, but it comes back with the error:

iPhoto got an error: Can’t make {"Photo1", "Photo2", "Photo3", "Photo4"} into type reference.

—

set nameList to {"Photo1", "Photo2", "Photo3", "Photo4"}
set albumName to "My Album"

tell application "iPhoto"
	activate
	select (every photo in album albumName whose name is in nameList)
end tell

Any ideas how to make this work?

Hello Dalmazio,

It seems there is a problem with the "is in" operator (and its mates "is contained by", "contains"...) when used within whose clauses in iPhoto:

tell application "iPhoto"
	tell album "Photos"
		photos whose name is "P7220017.JPG"
		photos whose name is not "P7220017.JPG"
		photos whose name begins with "P72200"
		photos whose name is in "aaaP7220017.JPGbbb"
		--> can't make "aaaP7220017.JPGbbb" into type reference
		photos whose name is in {"P7220017.JPG", "P7220018.JPG"}
		--> can't make {"P7220017.JPG", "P7220018.JPG"} into type reference
	end tell
end tell

So, I fear you would need to build the list of photos to be selected yourself, with something like this:

tell application "iPhoto"
	activate
	tell album "Photos"
		set L to {}
		repeat with N in {"P7220017.JPG", "P7220018.JPG", "P7220019.JPG"}
			copy photo N to the end of L
		end repeat
	end tell
	select L
end tell

But...
Here (10.5.6 with iPhoto 7.1.5),
	select L
doesn't do anything (and returns missing value).
I am limited to the selection of a single photo, for example:
	select item 2 of L
or:
	select photo "P7220018.JPG"

I must be missing something.
Axel _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >Select photos whose name is in list of names? (From: Dalmazio Brisinda <email@hidden>)

  • Prev by Date: Using Applescript to Sync and Mount drives etc.
  • Next by Date: Re: Using Applescript to Sync and Mount drives etc.
  • Previous by thread: Select photos whose name is in list of names?
  • Next by thread: Re: Select photos whose name is in list of names?
  • Index(es):
    • Date
    • Thread