Date des photos exportées de Photos vers Finder

zeltron54

Membre expert
Club iGen
29 Mars 2008
2 919
480
Lorraine
Ok !
je te met quand même le script qui te permet d'ajouter une date aux fichiers qui n'en ont pas.
Ce script est à enregistrer comment application, et sera un dropplet, il suffira de déposer un fichier sur son icone il te demande d'entrée la date au format AAAA:MM:JJ:HH:SS et il renseigne toutes les dates de ce fichier avec cette date.

Bloc de code:
on open the droppeditems
   
    set nom to the droppeditems
    set nom to nom as string
    display dialog "Entrer la date de creation AAAA:MM:JJ:HH:MN:SS" default answer ""
    set ladate to text returned of result
   
    set lacommande1 to "/usr/local/bin/exiftool -datetimeoriginal=" & ladate & " " & quoted form of POSIX path of nom
    set lacommande2 to "/usr/local/bin/exiftool -createdate=" & ladate & " " & quoted form of POSIX path of nom
    set datephoto to do shell script lacommande1
    set datephoto to do shell script lacommande2
   
    set lacommande3 to "rm " & quoted form of POSIX path of nom & "_original"
    set datephoto to do shell script lacommande3
   
    --pour date création et modification
    set yy to text 3 thru 4 of ladate
    set yyyy to text 1 thru 4 of ladate
    set mm to text 6 thru 7 of ladate
    set jj to text 9 thru 10 of ladate
    set hh to text 12 thru 13 of ladate
    set mn to text 15 thru 16 of ladate
    set ladate to mm & "/" & jj & "/" & yyyy & " " & hh & ":" & mn
    set lacommande1 to "setfile -m  " & "'" & ladate & "'" & " " & quoted form of POSIX path of nom
    set lacommande2 to "setfile -d  " & "'" & ladate & "'" & " " & quoted form of POSIX path of nom
    do shell script lacommande1
    do shell script lacommande2
end open