写真ファイルの作成日が、コピーや何かで変わってしまった時に、EXIF情報の撮影日を読み取り、作成日と変更日を書き換えます。
要 Xcode
要 ExifTool
tell application "Finder"set objs to selectionset lstr to (a reference to objs)end tellrepeat with obj in objs--作成日変更set objPOSIX to quoted form of the POSIX path of (obj as alias)set scrptCDR to "exiftool -CreateDate" & " " & objPOSIXdo shell script scrptCDRset CDR to resultset AppleScript's text item delimiters to ":"set CDRList to text items of CDRset yy to item 2 of CDRList --年取得set AppleScript's text item delimiters to spaceset yy to item 2 of text items of yyset mm to item 3 of CDRList --月取得set dd to item 4 of CDRList --日取得set AppleScript's text item delimiters to spaceset dd to item 1 of text items of ddset H to item 4 of CDRList --時取得set AppleScript's text item delimiters to spaceset H to item 2 of text items of Hset M to item 5 of CDRList --分取得set S to item 6 of CDRList --秒取得set scrptCDW to "/usr/bin/SetFile -d " & "'" & mm & "/" & dd & "/" & yy & " " & H & ":" & M & ":" & S & "'" & " " & objPOSIXdo shell script scrptCDW--ファイルの「作成日」取得set date_creation to creation date of objif modification date of obj > date_creation then--ファイルの「変更日」を変更set modification date of obj to date_creationend ifend repeat