• 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
More questions about scripting iPhoto
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

More questions about scripting iPhoto


  • Subject: More questions about scripting iPhoto
  • From: Chris Glowacki <email@hidden>
  • Date: Mon, 25 Feb 2008 18:31:00 -0800

Hello again,

I asked this question a while back and no one had an answer so I kludged this together in hopes that seeing working code might generate more comments than my vague 'How-Do-I-Do-This' Original Post...

Basically I wanted to create a script that exports files in iPhoto depending on a (single-valued) keyword.  Since there did not appear any way to create a list of photos with a specific keyword, I created a slew of smart folders for each keyword, and then process those (for my use, I have about 20 keywords which never change - so this is not so much work- especially since once you create a single smart folder, you can duplicate it rather easily).

Some questions for the scripting community:

I build two lists- one of photos, then one which replaces each photo with its POSIX file name- is there a 'better' way? this seems kludgy..
After I export an album, i'd like to delete the photos  but using "remove every photo from album (item j of key_list)'  seems to take forever- any idea why?
Is there some clever way to use iPhoto's native 'Export' feature via Applescript?

Any other comments are most welcome--

- chris


tell application "iPhoto"
activate
-- get all the smart albums with pictures in them except the ones used for high-level sorting
set dump_list to name of every album whose type is smart album
set key_list to {}


repeat with k from 1 to count of dump_list
if item k of dump_list is not "Sorted" then
if item k of dump_list is not "Unsorted" then
if item k of dump_list is not "Dups" then
if (count of photos of album (item k of dump_list)) is not 0 then
set end of key_list to item k of dump_list
end if
end if
end if
end if
end repeat


-- Pick a folder for the exported photos and create subdirectories for each subfolder with photos it it.
tell application "Finder"
set new_folder to choose folder
repeat with x from 1 to count of key_list
try
make new folder at folder new_folder with properties {name:item x of key_list}
end try
end repeat
end tell


-- process each smart folder
repeat with j from 1 to count of key_list
set move_list to {}
set plist to (every photo in album (item j of key_list))
if (count of plist) is not 0 then
repeat with k from 1 to count of plist
set end of move_list to image path of item k of plist as POSIX file as alias
end repeat
log move_list
tell application "Finder"
try
duplicate move_list to folder (item j of key_list) of folder new_folder with replacing
end try
end tell


end if
end repeat



end tell






 _______________________________________________
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: More questions about scripting iPhoto
      • From: "Mark J. Reed" <email@hidden>
  • Prev by Date: (no subject)
  • Next by Date: Smart Folder Scripting
  • Previous by thread: Re: Pathnames and opening files
  • Next by thread: Re: More questions about scripting iPhoto
  • Index(es):
    • Date
    • Thread