content top

Nick and Grai’s Epic USA Road Trip

Heres the travel blog for Graham and my Road Epic Road Trip around the US in Summer 2007. We bought a car in Florida and sold it (for a small profit!) in California nine weeks later after driving just over 11, 000 miles.

Leave a Reply...

Extracting Date Taken from Aperture 2.x using Applescript

The AppleScript capabilities of Aperture seem a little thin and far between, including the ability to extract useful metadata such as dates from image versions. However, Aperture’s database is a basic sqlite3 database (like so many other apple programs!), which is relatively easy to extract information from. The following script extracts the Aperture Date (not the exif info from the actual photo file, though they are likely to be the same) from an image version object passed to it:


on apertureDate(apertureImage)

--or where-ever your aperture library is
set apertureLibraryFileName to "~/Pictures/\"Aperture Library.aplibrary\"/Aperture.aplib/Library.apdb"
tell application "Aperture"
set imageID to id of apertureImage
end tell

set sqlQuery to "/usr/bin/sqlite3 " & apertureLibraryFileName & ¬

" \"select ZIMAGEDATE, ZIMAGETIMEZONENAME from zrkversion where zrkversion.zuuid = '" & imageID & "';\""
set imageParamsString to (do shell script sqlQuery)

--parse the sql result
set AppleScript's text item delimiters to "|"
set paramsArray to every text item of imageParamsString
set AppleScript's text item delimiters to ""
set imageDate to item 1 of paramsArray
set imageTimeZone to item 2 of paramsArray

--take the string to find the time offset, you will probably need to find out what your time zone is
if imageTimeZone is "US/Pacific" then
set imageGMT to 7
else if imageTimeZone is "US/Mountain" then
set imageGMT to 6
else
set imageGMT to 0
end if
set baseDate to (date "Monday, January 1, 2001 00:00:00")

return baseDate + imageDate - imageGMT * 3600

end apertureDate

Leave a Reply...

content top