Skip to main content
Participant
June 29, 2011
Question

Time of day filter

  • June 29, 2011
  • 1 reply
  • 687 views

I have a series of photos (taken as a timelapse) which I would like to filter by time of day as well as by date.  Is there a way to filter/search/select files based on the time they were taken, for example, all photos taken between 11:00 - 3:00, so I can then sort those by date after they have been selected?  Thanks

This topic has been closed for replies.

1 reply

Paul Riggott
Inspiring
June 29, 2011

You could try this bit of code.

First start Bridge and navigate to your folder with the documents you want to select.

Next, Start ExtendScript Toolkit.

This utility can be found in the relevant folder:-
PC: C:\Program Files\Adobe\Adobe Utilities
MAC: <hard drive>/Applications/Utilities/Adobe Utilities

Copy and paste the script into ExtendScript Toolkit window and run the code (Debug - Run or the play Icon)

This should then look at all the files in the folder and if the hour is between 11 - 15 it will label the file as 'To Do'


#target bridge
//amend to suit
var startHour = 11;
var endHour = 15;
/////////////////////////////////////
if(ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
var thumbs= app.document.visibleThumbnails;
for(var a =0;a<thumbs.length;a++){
if(thumbs.type != "file") continue;
var selectedFile = thumbs
.spec;   
var myXmpFile = new XMPFile( selectedFile.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_READ);
myXmp = myXmpFile.getXMP();
var date = myXmp.getProperty(XMPConst.NS_PHOTOSHOP, "DateCreated");
var thisHour =new Date(Date.parse(date)).getHours();
if(thisHour == NaN ) continue;
if( thisHour >= startHour && thisHour <= endHour) thumbs
.label = 'To Do';
}

SarahNebrAuthor
Participant
July 5, 2011

Hi Paul, Thanks so much for your quick reply.  I ran the script.  On the first time, it selected only a few of the many photos which should have fit the criteria.  I could not detect any pattern defining which ones were selected and which were not.  Thinking the partial success may have been due to the 12hr time format of the computer, I changed this to 24hr time format and restarted the machine.  Now, every time I try the script, the javascript console lists "Result: undefined".  Do you know what I am doing wrong or where I can go from here?  Thanks again for your time and help.