tell application "Photos" activate set imageSelection to (get selection) --cycle through selection repeat with i from 1 to count of imageSelection --get file name at each iteration set imageCurrent to item i of imageSelection set imageName to filename of imageCurrent --parse the file name into a datetime value -- clip-2018-09-28 08;10;36.mov if imageName begins with "clip-" then --grab the date string from the file name - since it's a fixed length, it's easy to grab set dateText to characters 6 thru 24 of imageName as string --manually parse the date string into a new date item set newDate to the current date set the month of newDate to (1 as integer) set the day of newDate to (1 as integer) set the year of newDate to (text 1 thru 4 of dateText) set the month of newDate to (text 6 thru 7 of dateText) set the day of newDate to (text 9 thru 10 of dateText) set the hours of newDate to (text 12 thru 13 of dateText) set the minutes of newDate to (text 15 thru 16 of dateText) set the seconds of newDate to (text 18 thru 19 of dateText) --set the datetimestamp of the current photo to that of the parsed datetime value tell imageCurrent set the date of imageCurrent to (newDate) as date end tell end if end repeat beep display dialog "Adjusted the date and time of " & (the length of imageSelection) & " items." end tell