• 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: Dalmazio Brisinda <email@hidden>
  • Date: Mon, 29 Dec 2008 14:23:11 -0600

Hello Axel,

Thanks for the response and confirmation of this problem in iPhoto scriptability support.

I find that the most frustrating thing about using AppleScript to control Apple's applications is that the support appears to be rather patchy. Being a new AppleScripter, this is especially annoying as much of the time I'm uncertain if my syntax/understanding is incorrect or if it's a bug in scriptability support.

Anyway, I ended up having to approach the solution in a roundabout way, by creating a new temporary album, and in a tight repeat loop copy the photo references in the list into the new album, and then when done select all the photos from the temporary album, then command- delete the selection. Oddly, I found out that there is some auto- threading behavior happening here, so that for large data sets, control returns back to my application even though the delete is not yet finished. Unfortunately there isn't an equivalent "importing" command for checking the status of the delete or a "busy" command or anything similar. So I ended up having to scrap this approach and doing it the slower but more reliable way of just removing all the photos from this list by name one by one.

Well, at least It works, even if it is a bit slow...

Best,
dalmazio



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
  • Prev by Date: Re: Transmit Help Needed
  • Next by Date: Move items to Trash - how to get "will get deleted immediately" warning shown?
  • Previous by thread: Re: Select photos whose name is in list of names?
  • Next by thread: Using Applescript to Sync and Mount drives etc.
  • Index(es):
    • Date
    • Thread