Satkin

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

Close

Q: Batch change date and time

  • All replies
  • Helpful answers

Page 1 Next
  • by léonie,Solvedanswer

    léonie léonie May 4, 2016 9:23 AM in response to Satkin
    Level 10 (105,274 points)
    iLife
    May 4, 2016 9:23 AM in response to Satkin

    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


  • by Old Toad,

    Old Toad Old Toad May 3, 2016 2:12 PM in response to Satkin
    Level 10 (140,881 points)
    Photos for Mac
    May 3, 2016 2:12 PM in response to Satkin

    One minute intervals are the smallest increments that can be created.  That's because seconds are not displayed in the date created field of the Info pane in Photos.

    Highlight001.jpg

    However, with léonie's changes the date can be incremented in 1 second intervals but it will take a 3rd party application like the free  EXIF Viewer for Mac OS X to be able to see the full date and time.

     

    Photos001.jpg  EXIF Viewer001.jpg

    OTsig.png

  • by Satkin,

    Satkin Satkin May 3, 2016 2:01 PM in response to léonie
    Level 1 (13 points)
    Photos for Mac
    May 3, 2016 2:01 PM in response to léonie

    Hi léonie,

    That's worked exactly how I was wanting it.  Thank you so much for such a quick reply!

  • by léonie,

    léonie léonie May 3, 2016 2:03 PM in response to Satkin
    Level 10 (105,274 points)
    iLife
    May 3, 2016 2:03 PM in response to Satkin

    You're welcome

  • by Old Toad,

    Old Toad Old Toad May 3, 2016 2:13 PM in response to léonie
    Level 10 (140,881 points)
    Photos for Mac
    May 3, 2016 2:13 PM in response to léonie

    léonie:

     

    Are you able to see the seconds in the Photos' Info pane for the date and time?

  • by léonie,

    léonie léonie May 3, 2016 2:16 PM in response to Old Toad
    Level 10 (105,274 points)
    iLife
    May 3, 2016 2:16 PM in response to Old Toad
    That's because seconds are not displayed in the date created field of the Info pane in Photos.

    You could change that, if you want, OT.

     

    When I experimented, I found that Photos is using the date format as set in the the System Preferences > Language & Region  Advanced > Times

     

    I set this format to always display the time zone:

     

     

    Screen Shot 2016-05-03 at 23.06.03GMT.jpg

     

    In Photos I am seeing:

    Screen Shot 2016-05-03 at 23.07.41GMT.jpg

  • by Old Toad,

    Old Toad Old Toad May 3, 2016 2:30 PM in response to léonie
    Level 10 (140,881 points)
    Photos for Mac
    May 3, 2016 2:30 PM in response to léonie

    I've tried the same setup and still can not get the seconds to display in Photos.  They do display in iPhoto, however.

  • by léonie,

    léonie léonie May 4, 2016 12:14 AM in response to Old Toad
    Level 10 (105,274 points)
    iLife
    May 4, 2016 12:14 AM in response to Old Toad
    I've tried the same setup and still can not get the seconds to display in Photos.  They do display in iPhoto, however.

    Did you restart both the Finder (Force quit) and Photos after you change the the Date & Time format?  It usually requires a restart, but I prefer to force quit the Finder.

     

    Photos is using the "Short" time format in the Info panel - the first line of the time formats in the system preferences.

     

    It is really unfortunate, that the Photos developers have this tendency to hide information or display it only imprecisely. How are they expecting us to deal with burst photos or to get the exact date and location of a photo?

    For my scientific photos I am still using the Aperture library, where the locations are displayed as latitude, longitude, altitude and not just as a location name without the altitude, and the capture date is displayed with the correct time zone.

  • by WJ713,

    WJ713 WJ713 May 17, 2016 7:30 AM in response to léonie
    Level 1 (8 points)
    Photos for Mac
    May 17, 2016 7:30 AM in response to léonie

    Will your script work to change the date of the picture into the future?

    In the Album I created - when I change the date of the first picture to a date that is in the future of the others in the batch the picture moves to the last position of the album.

    That causes a problem in using the script to change the batch to a date in the future.

    Am I thinking about this right?

  • by léonie,

    léonie léonie May 17, 2016 8:17 AM in response to WJ713
    Level 10 (105,274 points)
    iLife
    May 17, 2016 8:17 AM in response to WJ713
    Will your script work to change the date of the picture into the future?

    Yes, it does.

    when I change the date of the first picture to a date that is in the future of the others in the batch the picture moves to the last position of the album.

    Drag the photo back after you changed the date of the first image. That will set the sort order to a manual sort. Only then run the script.

  • by WJ713,

    WJ713 WJ713 May 17, 2016 9:27 AM in response to léonie
    Level 1 (8 points)
    Photos for Mac
    May 17, 2016 9:27 AM in response to léonie

    Thank you.  When it is too simple, you sometimes can't see it. 

  • by kwkiwi,

    kwkiwi kwkiwi Jun 14, 2016 4:10 PM in response to léonie
    Level 1 (12 points)
    Photos for Mac
    Jun 14, 2016 4:10 PM in response to léonie

    HI

    I tried your script and it worked after I had figured out how to copy and paste it into the script editor and run it. I haven't used that before!

     

    I also tried selecting multiple photos in Photos and then using the drop down menus of Image and 'adjust time and date'. That worked as well however it is there any way you can make it so that the adjusted dates are all on the same day? It seems to advance forward the dates and the adjusted dates are on different days.

     

    I am using Photos 1.5 and El Capitan 10.11.5

     

    Many thanks in advance

  • by léonie,

    léonie léonie Jun 14, 2016 11:50 PM in response to kwkiwi
    Level 10 (105,274 points)
    iLife
    Jun 14, 2016 11:50 PM in response to kwkiwi

    I also tried selecting multiple photos in Photos and then using the drop down menus of Image and 'adjust time and date'. That worked as well however it is there any way you can make it so that the adjusted dates are all on the same day? It seems to advance forward the dates and the adjusted dates are on different days.

    That is exactly why I wrote the script.

     

    The built-in "Adjust Date&Time" will shift the dates of all photos by a fixed in increament.  It is meant to be used, if the date in your camera is wrong and you need to correct it after you imported the photos taken with a wrong camera date. Or if you forget to set the camera to the correct time zone.

    But Photos has no tolls to to set the date for several scanned photos like iPhoto could.

  • by kwkiwi,

    kwkiwi kwkiwi Jun 15, 2016 1:12 AM in response to kwkiwi
    Level 1 (12 points)
    Photos for Mac
    Jun 15, 2016 1:12 AM in response to kwkiwi

    Thanks, didn't realise that. Just wanted to check that Apple hadn't in fact made it possible. Good on you for posting that script.

Page 1 Next