Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Copy reformatted date to custom field

I am scanning a lot of quite old film for which I can only guess at the date taken. Aperture import puts the timestamp of the scan in the date field. I have created a custom field "Date Shot". I will manually enter the date as yyyy-mm-dd (perhaps only year). I would like to be able to sort all of my photos by Date Shot. This means copying and reformatting the timestamp for all of my digital photos (in certain projects) into Date Shot.


It looks quite possible using AppleScript. I have done lots of programming, but know nothing about that language. Just quickly reviewed the Aperture 3 AppleScript document.


I would appreciate any ideas or code to use as a start for this effort. I assume one can pick out the date components and reformat using printf-type commands.

Posted on Mar 5, 2013 4:35 PM

Reply
Question marked as Best reply

Posted on Mar 5, 2013 5:13 PM

I've done some Aperture scripting. Some things work nice some things don't, Aperture is not the best example for first time application scripting.


There are many good resources on the web


These two from Apple

AppleScript Overview

AppleScript Language Guide


Two other good sites

macscripter.net

macosxautomation


Here is some code that takes a selection of images in Aperture, gets the EXIF date takes the time component from that and make a custom tag field name Capture Time and puts the time in it.


display dialog "Aperture will Start." & return & return & "Select image(s), press Continue when ready" buttons {"Continue", "Stop"} default button 1
set the user_choice to the button returned of the result

if the user_choice is "Stop" then
  tellme to quit
end if

tell application "Aperture"
  activate
          set imageSel to (get selection)

          if imageSel is {} then
                    error "Please select an image."
          else
                    repeat with i from 1 to count of imageSel
                              tell item i of imageSel
                                        set imageDate to value of EXIF tag "ImageDate"
                                        set s to time string of imageDate
                                         make new custom tag with properties {name:"Capture Time", value:s}
                              end tell
                    end repeat
          end if
end tell


Anyway this should give you a starting point. Good luck.


regards

1 reply
Question marked as Best reply

Mar 5, 2013 5:13 PM in response to Bruce Michel

I've done some Aperture scripting. Some things work nice some things don't, Aperture is not the best example for first time application scripting.


There are many good resources on the web


These two from Apple

AppleScript Overview

AppleScript Language Guide


Two other good sites

macscripter.net

macosxautomation


Here is some code that takes a selection of images in Aperture, gets the EXIF date takes the time component from that and make a custom tag field name Capture Time and puts the time in it.


display dialog "Aperture will Start." & return & return & "Select image(s), press Continue when ready" buttons {"Continue", "Stop"} default button 1
set the user_choice to the button returned of the result

if the user_choice is "Stop" then
  tellme to quit
end if

tell application "Aperture"
  activate
          set imageSel to (get selection)

          if imageSel is {} then
                    error "Please select an image."
          else
                    repeat with i from 1 to count of imageSel
                              tell item i of imageSel
                                        set imageDate to value of EXIF tag "ImageDate"
                                        set s to time string of imageDate
                                         make new custom tag with properties {name:"Capture Time", value:s}
                              end tell
                    end repeat
          end if
end tell


Anyway this should give you a starting point. Good luck.


regards

Copy reformatted date to custom field

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.