No one was able to answer my earlier question about how to do this, so I share my crude results here- which seem to work,
and request instead any comment on how to speed up or otherwise improve this brute force script.
In iPhoto I create two smart folders called 'Sorted' and 'Unsorted' whose contents are based on pass (and fail) criteria of 'Keyword is none' .
To sort my shoots, I open the 'Unsorted' folder, and as I attach keywords, files are removed (and subsequently added to the 'Sorted' folder)
When I'm done, I would like to export the files to folders named by keyword (ex: "Sunset", "River", "Junk" etc- and I now only have to look at the files in the 'Sorted' folder)
In iPhoto you can select 'Library', and click on a keyword to get all photo's containing that keyword- you can then Select all, and export.
This is the function I was trying to duplicate in AS-- What I came up with is rather crude- since I can't export en masse, but must do so photo-by-photo-which is still faster than my previous manual method
- it works well, but I'm willing to be those of you who are 'real' scripters can speed it up.. Maybe offer a suggestion on how to handle multiple keywords?
Also- when you import files to iPhoto (6)- they do not immediately show up in a Smart folder unless you re-start iPhoto, or edit the Smart Folder (I just go 'edit smart album' and then re-save without making any changes)- is there a way to force this to happen in AS?
thanks in advance
chris
>> Here is my export-by-keyword script:
tell application "iPhoto"
set kwlist to name of every keyword
tell application "Finder"
set sort_folder to choose folder
repeat with i from 1 to count of kwlist
set this_folder to item i of kwlist
set its_here to exists folder (item i of kwlist) of folder sort_folder
if not its_here then
try
set f1 to make new folder at sort_folder with properties {name:this_folder}
end try
end if
end repeat
end tell
set the_album to "Sorted"
set photo_list to every photo in album the_album
log photo_list
set the_photo_count to count of photo_list
repeat with pcount from 1 to the_photo_count
set this_photo to item pcount of photo_list
set this_keyword to name of keyword 1 of this_photo
set thisphoto to image path of this_photo as POSIX file as alias
tell application "Finder"
duplicate thisphoto to folder this_keyword of folder sort_folder replacing yes
end tell
remove this_photo
end repeat
end tell