Created
December 27, 2008 03:55
-
-
Save ishikawa/40185 to your computer and use it in GitHub Desktop.
Copy all photos of the album of iPhoto | iPhotoExporter.applescript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- iPhotoExporter.applescript | |
-- Copy all photos of the album of iPhoto | |
on exportAlbum(theRecord) | |
tell application "Finder" | |
set theArchiveFolder to folder "iphoto" of desktop | |
try | |
make new folder at theArchiveFolder with properties {name:name of theRecord} | |
end try | |
set theAlbumFolder to folder (name of theRecord) of theArchiveFolder | |
repeat with imagePath in (photoList of theRecord) | |
duplicate (imagePath as POSIX file) to theAlbumFolder with replacing | |
end repeat | |
end tell | |
end exportAlbum | |
tell application "iPhoto" | |
-- Specify the album which will be exported | |
set theFolder to album 4 | |
-- For large lists, it is more efficient to | |
-- use a reference to operator | |
set theAlbumList to children of theFolder | |
set theAlbumListRef to a reference to theAlbumList | |
--set theAlbumList to items 95 thru 95 of theAlbumListRef | |
set theRecordList to {} | |
set theRecordListRef to a reference to theRecordList | |
repeat with theAlbum in theAlbumListRef | |
if type of theAlbum = regular album then | |
set albumRecord to {name:name of theAlbum, photoList:{}} | |
set photoListRef to (a reference to photoList of albumRecord) | |
repeat with thePhoto in photos of theAlbum | |
copy image path of thePhoto to the end of photoListRef | |
end repeat | |
copy albumRecord to the end of theRecordListRef | |
end if | |
end repeat | |
end tell | |
repeat with theRecord in theRecordListRef | |
exportAlbum(theRecord) | |
end repeat | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment