Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Sort by time of day, regardless of date

Is there any way to sort the Images in the Browser by time of day, independent of date? Time is available -- each Image has a date/time stamp, and the Filter HUD Rule "Date" includes a "Capture Hour" option.


Thanks.


(Ideally, I'd like to sort by solar time -- I'd think this would be of interest to naturalists -- but that seems to be a project for coming years.)


Message was edited by: Kirby Krieger -- corrected name of Rule option.

MacBook Pro 13, Mac OS X (10.6.8), 8 G / 500 G internal / 5 TB external / NEC 2490 / ColorMunki Pho

Posted on Jan 12, 2012 4:32 AM

Reply
Question marked as Best reply

Posted on Jan 12, 2012 5:13 AM

Ah you don't remeber this Possible to sort by time (and only time)

31 replies

Jan 12, 2012 5:48 AM in response to Frank Caggiano

Brilliant!


Just to make sure (I'm rather dim regarding scripts): What I did was copy your code into the Scripts Editor, and then save it in "~/Library/Scripts/Aperture" as "Create and Fill Custom Time Field for selected Aperture Images" (yes, didn't have to make the name so descriptive). Then I select Images in Aperture, click the Script menulet and select "Create and Fill ... ". I have to manually add the custom field "Capture Time" to my Metadata Overlay(s) and/or Metadata Preset(s) -- and of course the Overlay to add it to is "List View", so that I can then sort on it in the Browser.


Is that the best way to do it?


I see you include it on Import. I'm still mulling that over ... I will likely do it after Import by Project as needed.


Thanks for remembering and for providing your script!

Jan 12, 2012 7:06 AM in response to Kirby Krieger

More easily done than I thought. I changed all my time formats to 24-hour format (I used "00-23"), deleted the contents of the "Capture Time" field, and ran Frank's script again. Screenshot:

User uploaded file


We still need to work on having the percentage offset from solar noon (which is still what I want), but this is useful and most appreciated.

Jan 12, 2012 8:16 AM in response to Kirby Krieger

Just back, I see you have it pretty much worked out. Glad to help.


Right once the script adds the custom field and populates it then you can use it the same as any metadata field in Aperture. Does that answer the question?


Anyway as for needing to have 24hr time set, yeah for time sorting that's pretty much a have to have. As you found out sorting times with AM PM doesn't work to good. I suppose the script could translate the times into a 24 hour format regardless of the system settings. I always use 24 hour time, just seems to make more sense and it drives my kids insane (explaining to their friends why the microwave says it's 20:37)


Using it on import, I added this code into my standard on-import script so it gets run on all new images. If you will be running it on images on a need-to-have basis you might want to turn it into a service, this way you can just access it from the Aperture->Services menu. It would be a fairly easy conversion let me know if you're interested.


regards


Message was edited by: Frank Caggiano - Interested in hearing more about the solar offset you mentioned.

Jan 12, 2012 2:10 PM in response to Frank Caggiano

Frank -- thanks for the offer to create a Service instead of a Script. Not worth the time. Works fine as a Script: easily available from my Menubar (along with some other Aperture scripts).


Does the script produce a "time-code" that is then formatted according to system settings, or is the result straight text?


There are four Times formats set system-wide. If the script result is a time-code that is then formatted according to the system setting, then I need only set one of them to 24-hour time. But it may be that the script needs 24-hour time as input. (I think it's the former -- I'm asking to save me the trouble of trying all the possibilities.)

Screenshot:

User uploaded file


Re: %age offset from solar time. That was something we touched on in the thread you cited. My interest is in exactly that: the angle of inclination at the time of exposure. "Time of day" is no more than a rough proxy for that. Since we now have universal time and global geo-coding, the angle of inclination should be easy to compute for any photograph. My interest isn't forensic in a hard sense: for my nature photographs, I'm interestedin how they document diurnal rhythms (and, in an artistic sense, what I'm calling "the natural rhythm of light"). I'm operating on the assumption that those rhythms follow the sun, and rhyme only vaguely with the steady tick-tocking of our masterful timekeepers. Currently I'm working on a sort of "Year as a Day" collection of photos taken in one particular National Park (Blackwater NWR on Maryland's Eastern Shore) over the course of a couple of years. I'm manually sorting the good photos into the day's rhythm. Sorting them by time is a helpful start (but still, naturally, quite bejiggled from my aim).

Jan 12, 2012 3:10 PM in response to Kirby Krieger

I made a change to the script which should eliminate the need to set your system time to 24hr format (even though that's what all the kool kids do)


Here it is:


display dialog "Aperture will Start." & return & return & "Select image(s), press Continue when ready" buttons {"Continue", "Stop"} default button 1

set the user_choice to the button returned of the result


if the user_choice is "Stop" then


tellmetoquit

end if


tell application "Aperture"


activate

set imageSel to (get selection)


if imageSel is {} then

error "Please select an image."

else

repeat with i from 1 to count of imageSel

tell item i of imageSel

set imageDate to value of EXIF tag "ImageDate"

set hrs to hours of imageDate

if hrs < 10 then

set hrs to "0" & hrs

end if


set mins to minutes of imageDate

if mins < 10 then

set mins to "0" & mins

end if


set secs to seconds of imageDate

if secs < 10 then

set secs to "0" & secs

end if


set timeString to (hrs & ":" & mins & ":" & secs) as rich text

display dialog "Time is: " & timeString


--set s to time string of imageDate


makenewcustom tagwith properties {name:"Capture Time", value:timeString}

end tell

end repeat

end if

end tell



It dismantles the time in the EXIF data and puts it back together again in 24 hr format. At least that is what I think it will do. As I said I have my system set to 24 hour format and my Canon only does 24 hour in the EXIF data so I can't really give ti a good test.


Give it a shot and if it works you won't need to change your system time format.

Jan 12, 2012 3:35 PM in response to Kirby Krieger

If I'm understanding you what you are looking for is true solar time, correct?


Wall time is only an aproximation of solar time and is is only correct at the midpoint of a time zone when no daylight saving time is in effect you would need to calculate your position and then apply a correction.


For example when the wall clock says it is 12:00 locations to the east of the TZ midpoint will have later solar times and locations to the west of the midpoint will have earlier solar times.


If you Google solar time you'll get a number of interesting hits.


Let me know if I'm understanding what you are looking for,


regards


Take a look atSolar Position Calculator from NASA


this is pretty kool too


Solar Time


Message was edited by: Frank Caggiano

Sort by time of day, regardless of date

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