Question: select one out of multiple date formats

Talk, speculate, discuss, pontificate. As long as it pertains to Hazel.

Moderators: Mr_Noodle, Moderators

Hazel is a wonderful app which made my life a lot easier and 'complicated'.
I am struggling with something that I would have not had to, if I did not know Hazel. :roll:

With recent purchase of a nice scanner and its built-in OCR function, (oh, I love this ScanSnap, too), I tried to scan all my receipts. Since having found out that Hazel can pick up the matched contents from the scanned file, I wanted to put purchase date into the file name automatically.

The problem is that merchants/ vendors use various formats of date, for example, 01-03-2014, 1.3.2014, 01.03.14, 1/03/2014, 01/03/14, 2014-03-01, 03-01-2014, Mar.01.2014 etc.
Like most people, I'd like to put one and consistent format of date for naming my files.
ex. receiptx_yummyrestaurant_paris_2014-0301-1845.pdf

My question is how I can make a rule so that Hazel could put the specific date format into my scanned file.

I'd appreciate if anyone can help me.
gammachar
 
Posts: 3
Joined: Fri Mar 21, 2014 5:50 pm

When you add the date token to your pattern for renaming, click on it and you'll see an option to edit the date format. There you can format the date however you want.
Mr_Noodle
Site Admin
 
Posts: 11236
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Hi Mr. Noodle, Thank you for your answer.

I should have made my question clearer.
My question was how I could pick up the various date formats by one rule.

Since I do not have any idea how to make it simple, I made a long list of 'contents match' nested rules each of which has a specific format. I know it is not a good solution, but at least it works for me. Although not being really satisfied with it, I learned a lot how to use Hazel while having struggled with any possible solutions. :) I appreciate again for making this great app.

(Btw, on my 13" 2010 MacBook, I cannot put more than 10 lists, because I cannot edit the custom token which lies below the screen. It is not a Hazel issue, but a system preference one, because its screen cannot be resized.)
gammachar
 
Posts: 3
Joined: Fri Mar 21, 2014 5:50 pm

I am looking into adding the capability of having several patterns for a single custom token but yes, for now you'll have to have a separate condition for each one with a new custom token in each case.
Mr_Noodle
Site Admin
 
Posts: 11236
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Hi Gammachar,
would you mind sharing your nested rule for multiple dates?
I'm having exactly the same challenge.

Thanks and regards,
Andre

gammachar wrote:Hazel is a wonderful app which made my life a lot easier and 'complicated'.
I am struggling with something that I would have not had to, if I did not know Hazel. :roll:

With recent purchase of a nice scanner and its built-in OCR function, (oh, I love this ScanSnap, too), I tried to scan all my receipts. Since having found out that Hazel can pick up the matched contents from the scanned file, I wanted to put purchase date into the file name automatically.

The problem is that merchants/ vendors use various formats of date, for example, 01-03-2014, 1.3.2014, 01.03.14, 1/03/2014, 01/03/14, 2014-03-01, 03-01-2014, Mar.01.2014 etc.
Like most people, I'd like to put one and consistent format of date for naming my files.
ex. receiptx_yummyrestaurant_paris_2014-0301-1845.pdf

My question is how I can make a rule so that Hazel could put the specific date format into my scanned file.

I'd appreciate if anyone can help me.
Andre
 
Posts: 1
Joined: Fri Feb 06, 2015 7:45 am

Note that in the latest version of Hazel, you can use re-use custom attributes. Therefore, you can have multiple conditions all use the same custom attribute, using a different date format for each one. Only the first one which matches will get assigned to the attribute itself.
Mr_Noodle
Site Admin
 
Posts: 11236
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Another challenge with solving this problem is the document may have several different dates. A useful enhancement would be to have more options than just "nth from beginning/end", e.g., earliest, latest, closest to today. Another enhancement I thought of would be for Hazel to be more tolerant with OCR errors, e.g. "ll' (two lower case L's) could match as 11 (number eleven).
JBB
 
Posts: 21
Joined: Mon Sep 12, 2011 6:09 pm

I'll consider the date thing though concrete examples will help here.

Yeah, it's a bit tough with OCR errors. There are a ton of ways for things to go wrong and not all of them are easily detectable and could make pattern matching much slower, depending. Nonetheless, it's something I'm considering.
Mr_Noodle
Site Admin
 
Posts: 11236
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:I'll consider the date thing though concrete examples will help here.

Yeah, it's a bit tough with OCR errors. There are a ton of ways for things to go wrong and not all of them are easily detectable and could make pattern matching much slower, depending. Nonetheless, it's something I'm considering.


I too would like a way to say "earliest" or "latest" date matched. A concrete example is my water bill for some reason matches the billing date as the 1st occurrence and sometimes the 2nd occurrence, but regardless the earliest date is always the bill date (with the latest date being the due date). I'm sure a work around is to add some script, but would love a built in solution to this problem.
dissolved
 
Posts: 1
Joined: Thu May 07, 2015 1:27 pm

Is there some text surrounding the date that you could use to match?
Mr_Noodle
Site Admin
 
Posts: 11236
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Open Discussion