Problems with custom date tokens

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Problems with custom date tokens Sun Feb 15, 2015 3:24 pm • by rjames86
I've been playing around with using custom date tokens and extracting exif data from photos. So far, I've been able to successfully extract the photo's capture time and return it as an hazelOutputAttribute using JavaScript in an external script

Code: Select all
function hazelMatchFile(theFile, inputAttributes)
{
    var app = Application.currentApplication();
    app.includeStandardAdditions = true;

    var checkDate = app.doShellScript("exiftool -s3 -DateTimeOriginal '" + theFile + "'");

   if (checkDate == ""){
      return false
   }
   
    date = checkDate.slice(0,10).replace(/:/g, '/')
    hours = checkDate.split(' ')[1]

    outputDate = new Date(date + ' ' + hours)

    obj =  {
       hazelOutputAttributes: [outputDate],
       hazelPassesScript: true
    }

    return obj
}


I'm running into two issues:

1. Hazel doesn't seem to save the custom attributes when re-opening the rule. This means that each time I re-open the script, I have to remove all uses of the custom attribute token, re-add it in the Options pane, and then re-add them where I used them previously.

2. Edit Date Pattern doesn't seem to respect what I put in for hour, minute and seconds.

An example:

YY-mm-dd HHxMMxSS
Image

Tailing the Hazel logs, I get this

Code: Select all
2015-02-15 11:17:02.092 hazelworker[35303] [Custom Message] Hazel Alert: 15-02-15 22:49:03


No matter what separator I use for the HH:MM:SS, including no separator at all, I still get colons.

Thanks!
rjames86
 
Posts: 7
Joined: Mon Mar 10, 2014 9:38 am

Re: Problems with custom date tokens Mon Feb 16, 2015 12:29 pm • by Mr_Noodle
What version of Hazel are you running? Can you email support with the rule(s) in question?
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Problems with custom date tokens Mon Feb 16, 2015 12:38 pm • by rjames86
Currently running version 3.3.4 (b 1232)

I'll send the rule over now. Thanks!
rjames86
 
Posts: 7
Joined: Mon Mar 10, 2014 9:38 am


Return to Support