• 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: How to check for and remove a photo from an iPhoto album
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to check for and remove a photo from an iPhoto album


  • Subject: Re: How to check for and remove a photo from an iPhoto album
  • From: Paul J.Lucas <email@hidden>
  • Date: Tue, 2 Jun 2009 21:52:17 -0700

After some more experimentation, I figured out /a/ solution:

	set thePhotos to every photo of album "MyAlbum"
	repeat with thePhoto in thePhotos
	    if image filename of thePhoto is equal to "pic1.jpg" then
	        remove thePhoto
	        exit repeat
	    end if
	end repeat

I did also figure out that you can say:

	set fileNames to image filename of every photo of album "MyAlbum"
	if fileNames contains "pic1.jpg" then
	    -- ...
	end if

The problem with that, however, is that you don't have a reference to the relevant photo object to pass as an argument to remove.

Of course, if there is a more efficient solution (perhaps one that doesn't use explicit iteration), I'd love to see it.

- Paul


On Jun 2, 2009, at 8:50 PM, Paul J. Lucas wrote:

I want to write an AppleScript to import a photo into an album. If a photo with the same file-name already exists in the given album, I want to remove the existing one first, then proceed with the import. I tried:

	if album "MyAlbum" contains "pic1.jpg" then
	    remove "pic1.jpg" from album "MyAlbum"
	end if

but that doesn't compile. (I know how to do the actual import part.)
_______________________________________________
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
  • Follow-Ups:
    • Re: How to check for and remove a photo from an iPhoto album
      • From: Barry Wainwright <email@hidden>
References: 
 >How to check for and remove a photo from an iPhoto album (From: "Paul J. Lucas" <email@hidden>)

  • Prev by Date: Re: Same code gives different answers in 2 different scripts
  • Next by Date: Re: How to check for and remove a photo from an iPhoto album
  • Previous by thread: How to check for and remove a photo from an iPhoto album
  • Next by thread: Re: How to check for and remove a photo from an iPhoto album
  • Index(es):
    • Date
    • Thread