-- Forcer la date de création des photos à celle de l'EXIF, si présent.
do shell script "echo Fichiers non traités > ~/Desktop/'set creation date.log.txt' ; echo ' ' >> ~/Desktop/'set creation date.log.txt'"
createList(choose folder with prompt "Sélectionnez le dossier contenant les images à traiter")
on createList(item_list)
set the the_items to list folder item_list without invisibles
set item_list to item_list as string
repeat with the_item in the_items
set the_item_alias to (item_list & the_item) as alias
if folder of (info for the_item_alias) then
my createList(the_item_alias)
else
tell application "Finder"
set nom_script to "echo " & POSIX path of the_item_alias & " >> ~/Desktop/'set creation date.log.txt'"
try
set datephoto to do shell script "sips -g creation " & quoted form of POSIX path of the_item_alias
on error
set datephoto to ""
end try
if datephoto ends with "<nil>" or length of datephoto ≤ 20 then
try
do shell script nom_script
end try
else
set DateOriginale to text -20 thru -1 of datephoto
set ladate to text 1 thru -16 of DateOriginale
set ladate to ladate & text 7 thru -13 of DateOriginale
set ladate to ladate & text 10 thru -10 of DateOriginale
set ladate to ladate & text 13 thru -7 of DateOriginale
set ladate to ladate & text 16 thru -4 of DateOriginale
set ladate to ladate & "." & text 19 thru -1 of DateOriginale
-- display dialog ladate
try
do shell script "touch -t " & ladate & " " & quoted form of POSIX path of the_item_alias
on error
try
do shell script nom_script
end try
end try
end if
end tell
end if
end repeat
end createList
tell application "Finder"
(display dialog ("waouou ... Ca y est c'est fait !") buttons {"Salut !"})
end tell