Q: Batch change date and time
I've got a large number of photos that for some reason have lost their correct dates and creation times, so I was wanting to fix them in a nice easy way. Unfortunately I've found out that Photos doesn't have the batch change option that used to be in iPhoto.
When trying to find a solution to my problem I came across this Batch Change the Date and Time to a Fixed Date, which works great, but not quite how I want it to. What I'm wanting to do is exactly what the above script does, but instead of incrementing by 1 minute per photo, I want to increment by 1 second intervals per photo.
Having not really used AppleScript before, I tried changing the references to "minutes" to "seconds" but that didn't work. Is it possible to do the above using seconds instead of minutes?
Any guidance would be greatly appreciated. Thanks.
Posted on May 3, 2016 1:18 PM
Simply delete the text " * minutes" in the lines where the date is changed.
Then the time will be incremented by seconds.
For example for the first version of the script use:
set timeIncrement to 1 -- the time increment in seconds
(* select at least 2 images in Photos *)
tell application "Photos"
activate
set imageSel to (get selection)
if (imageSel is {}) or (the length of imageSel < 2) then
error "Please select at least two images."
else
set first_image to item 1 of imageSel
set first_date to (the date of first_image) as date
repeat with i from 2 to count of imageSel
set next_image to item i of imageSel
set next_date to (the date of next_image) as date
set time_difference to (first_date - next_date) + ((i - 1) * timeIncrement)
tell next_image
set the date of next_image to (next_date + time_difference) as date
end tell
end repeat
end if
return "Adjusted the date and time of " & (the length of imageSel) & " photos. The last date is " & ((the date of next_image) as date)
end tell
Posted on May 4, 2016 9:23 AM