"On This Day" Feature for mac Photos, does it exist?

Hello,


I love the Facebook feature "On this Day" but would love to have it on my mac rather than upload my entire photo collection to FB for this to work year on year etc. Does anybody know how to replicate this through scripting, 3rd party app etc?

Posted on Mar 6, 2016 1:44 PM

Reply
29 replies

Mar 8, 2016 7:54 AM in response to Solamanzi

I just noticed, the 1st of December is also not found, if I simply set the the day and the month manually.

When I change the script to first create a date object, and then change the day and month field in the date object, this date is found as well:


You may want to try this modification:

-- find all photos taken on a certain day, for example the day of the current date.

-- the resulting photos will be added to a toplevel album named "On day month".



set thisdate to the (current date) as date -- create a date object

set the month of thisdate to 12 -- change this to the month you want, for example

set the day of thisdate to 1 -- change this to the day you want, for example "25"


set thisday to the day of (thisdate as date)

set thismonth to the month of (thisdate as date)

--return {thisday, this month} -- just testing


set thisDayAlbum to "On " & thismonth & " " & thisday as string


tell application "Photos"

try


if existscontainerthisDayAlbum then


set thePhotosBuffer to containerthisDayAlbum

else


makealbumnamedthisDayAlbum


end if

on error errTexttwonumbererrNumtwo

display dialog "Cannot open album: " & thisDayAlbum & " " & errNumtwo & return & errTexttwo

return

end try


set onthisdayFound to {}

set onthisdaySkipped to {}



set allTheItems to every media item-- get a list of all photos and videos, may take a while


-- add all photos taken this day to the album


repeat with i from 1 to the count of allTheItems


-- check the dates of all photos and videos

set thisMediaItem to itemi of allTheItems

try

set date_i to the date of thisMediaItem

set day_i to the day of (date_i as date)

set month_i to the month of (date_i as date)

if ((day_i = thisday) and (month_i = thismonth)) then

set end of onthisdayFound to thisMediaItem


add {thisMediaItem} tocontainerthisDayAlbum

end if

on error errTexttwonumbererrNumtwo

set end of onthisdaySkipped to thisMediaItem

end try

end repeat

end tell


set theresultmessage to "Found " & (the count of onthisdayFound) & " items and added them to the album " & thisDayAlbum & ".

Skipped " & (the count of onthisdaySkipped) & " items without date"


display dialogtheresultmessage

Mar 8, 2016 11:12 AM in response to Solamanzi

I would simply ctrl-click the album in Photos sidebar and select "Delete Album" from the pop-up menu before you run the script. It will delete the album, but keep your photos in the library.


If you want to start with an empty album and include this deletion into the script, do it this way:

If the album exists, delete it, then recreate it unconditionally. This way the script will always start with an empty album.

if existscontainerthisDayAlbum then

delete the containerthisDayAlbum

end if


makealbumnamedthisDayAlbum

The script will now look like this:

------------------------------------------------------------


set thisdate to the (current date) as date-- create a date object

set the month of thisdate to 12 -- change this to the month you want, for example "12"

set the day of thisdate to 1 -- change this to the day you want, for example "1"


set thisday to the day of (thisdate as date)

set thismonth to the month of (thisdate as date)

--return {thisday, thismonth}


set thisDayAlbum to "On " & thismonth & " " & thisday as string


tell application "Photos"

try


if existscontainerthisDayAlbum then

delete the containerthisDayAlbum

end if


makealbumnamedthisDayAlbum

on error errTexttwonumbererrNumtwo

display dialog "Cannot create album: " & thisDayAlbum & " " & errNumtwo & return & errTexttwo

return

end try


set onthisdayFound to {}

set onthisdaySkipped to {}



set allTheItems to every media item-- get a list of all photos and videos, may take a while


-- add all photos taken this day to the album


repeat with i from 1 to the count of allTheItems


-- check the dates of all photos and videos

set thisMediaItem to itemi of allTheItems

try

set date_i to the date of thisMediaItem

set day_i to the day of (date_i as date)

set month_i to the month of (date_i as date)

if ((day_i = thisday) and (month_i = thismonth)) then

set end of onthisdayFound to thisMediaItem


add {thisMediaItem} tocontainerthisDayAlbum

end if

on error errTexttwonumbererrNumtwo

set end of onthisdaySkipped to thisMediaItem

end try

end repeat

end tell


set theresultmessage to "Found " & (the count of onthisdayFound) & " items and added them to the album " & thisDayAlbum & ".

Skipped " & (the count of onthisdaySkipped) & " items without date"


display dialogtheresultmessage




If you are seeing an alert "Apple event timed out", you may not have responded to the dialog panel. This can happen, if the panel is hidden behind other windows.

Mar 8, 2016 11:20 AM in response to léonie

Come to thing about it, I would insert a line "delay 2" after the deletion of the album. This will avoid timeout errors, if Photos needs bit longer to delete the album.


try


if existscontainerthisDayAlbum then

delete the containerthisDayAlbum

delay 2 -- second try after delay

end if


makealbumnamedthisDayAlbum-- create a new, empty album

on error errTexttwonumbererrNumtwo

display dialog "Cannot create album: " & thisDayAlbum & " " & errNumtwo & return & errTexttwo

return

end try

Mar 8, 2016 1:20 PM in response to léonie

Yep That's the ticket.

My final script is this:


set thisdate to the (current date) as date

-- create a date object


set thisday to the day of (thisdate as date)

set thismonth to the month of (thisdate as date)

-- return {thisday, this month}


set thisDayAlbum to "On This Day"

-- create an Album called On This Day


tell application "Photos"

try

if existscontainerthisDayAlbum then


delete the containerthisDayAlbum


delay 2 -- second try after delay

end if


makealbumnamedthisDayAlbum-- create a new, empty album

on error errTexttwonumbererrNumtwo


display dialog "Cannot create album: " & thisDayAlbum & " " & errNumtwo & return & errTexttwo

return

end try


set onthisdayFound to {}

set onthisdaySkipped to {}


set allTheItems to every media item

-- get a list of all photos and videos, may take a while

-- add all photos taken this day to the album


repeat with i from 1 to the count of allTheItems


-- check the dates of all photos and videos

set thisMediaItem to itemi of allTheItems

try

set date_i to the date of thisMediaItem

set day_i to the day of (date_i as date)

set month_i to the month of (date_i as date)

if ((day_i = thisday) and (month_i = thismonth)) then

set end of onthisdayFound to thisMediaItem


add {thisMediaItem} tocontainerthisDayAlbum

end if

on error errTexttwonumbererrNumtwo

set end of onthisdaySkipped to thisMediaItem

end try

end repeat

end tell


set theresultmessage to "Found " & (the count of onthisdayFound) & " items and added them to the album " & thisDayAlbum & ".

Skipped " & (the count of onthisdaySkipped) & " items without date"


display dialogtheresultmessage


I have set this to run every morning.


The result is at breakfast, provided there are actually photos present, we can all watch the screen saver which will take pics from the "On This Day" Album... AWESOME thanks so much to you all for helping out.


Now next steps, show the Location, Dates, and possibly the peoples names, garnered from the "faces" in each picture during a slide show...


User uploaded fileUser uploaded file

Mar 8, 2016 1:32 PM in response to Solamanzi

Great idea to have this as a screensaver 🙂


Now next steps, show the Location, Dates, and possibly the peoples names, garnered from the "faces" in each picture during a slide show...

That part is not yet scriptable in Photos.

You can help by sending feedback to Apple, to add more scripting support to Photos, and make the slideshow themes more vrsatile. Previously it was possible to use the metadata of the photos in the screensaver or in aslideshow, but that is not possible in Photos.


The feedback form is here: Apple - Photos - Feedback

You could file a feature reqest or usability problem.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

"On This Day" Feature for mac Photos, does it exist?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.