Exporting 43,000 Photo

I built a script to export my entire Aperture database into TIFF format with embedded tags. Aperture crashes if I export more than 300 simultaneously, so I have a repeat loop telling it to export only one image at a time. It works, but at it’s present speed will take an additional 80 hours. There is a large gap between each of the repeat loops, almost a full second, I think because there are so many items in the list of photos. Is there a way to speed this up? A lot of time is wasted with this gap, time that the script is working but Aperture is idle; I was hoping that my list could be managed more efficiently. Thanks!

This is the script, partly from something I found in this forum:


tell application "Finder" to set exportLocation to (choose folder with prompt "Choose export destination") as alias

tell application "Aperture"
set allImages to every image version as list

repeat with anImage in allImages
export (anImage as list) naming files with file naming policy "Version Name and Date/Time" naming folders with folder naming policy "Complete Export" to exportLocation metadata embedded
end repeat
end tell


I think I have a solution. This is just a rough draft, I haven’t started to debug it yet.


set subroutines to load script alias "Europa:Users:Jamie:Documents:Scripts:Subroutines.scpt"
tell app "Path Finder"
    choose folder with prompt "Choose a folder to export your photos to:"
    set exportLocation to the result
end tell
set errorList to {}
tell app "Aperture"
    set projs2export to {}
    set allProjects to every project
    repeat with i in allProjs
        set icount to the count of (image versions of project i)
        if icount > 0
            set the end of projs2export to i
        else
            tell subroutines to log(((name of i) & " has no photos in it."), "Fawkes:Export Log.txt", true)
        end if
    end repeat
    repeat with exproj in projs2export
        set allVer to every image version of project exproj
        set icount to the count of allVer
        if icount < 100
            tell subroutines to apexport(allVer, true, "iPhoto Export") --The format will be : images to export, with metadata, and folder naming policy
        else if icount > 100
            repeat
                set groupcount to count of allVer
                set groupex to items 1 thru 100 of allVer
                tell subroutines to apexport(groupex, true, "iPhoto Export")
                if (groupcount-100) >= 101 then
                    set allVer to (items 101 thru -1 of allVer)
                else if (groupcount-100) < 100 then
                    tell subroutines to apexport(((items 101 thru -1 of allVer) as list), true, "iPhoto Export")
                    exit repeat
                end if
            end repeat
        else
            set the end of errorList to (exproj as list)
        end if
    end repeat
    tell subroutines to log((errorList as text), "Fawkes:Export Log.txt", true)
end tell

tell app "Path Finder"
    reveal exportLocation
    say "Congratulations Jamie"
    display dialog "The job is done."
end tell