I’m trying to set up a set of rules that renames various bank statement and bill PDFs so that no matter when I download them they are renamed to format YYYY-MM-DD_rest of name.
What I want is to look in the PDF and find the statement date, whose format varies, and then use that in the rename.
Alternatively I could accept Hazel renaming using the format --_
Is there any way to specificy the previous month as the date or the last day of the month or read a date in a different format and then use it like a variable? I’m brand new to attempting to get Hazel to do stuff and I can’t seem to find it in the help info.
I would think that what you are looking for is the rule “Contents” and the criteria “Contain Match”.
When you select those options, you get a pop-up to create a template for the match. The way you might use that template is to put in some sort of text that will match whatever text precedes the statement date in your statement, followed by the “custom date” element.
For the custom date element, you can either let Hazel autodetect the date format (that’s a checkbox), or built a date template with the format used in the statement (uncheck the autodetect option and options for building the date template will come up).
The key here is that you can give the custom date element a name, which you can then use later on in your actions as part of the rename process.
To make this work, the statement is going to want to be ocr’d (I automatically ocr everything that comes in from my ScanSnap with the ScanSnap software, and use PDFPenPro to ocr everything else) so that the text items can be best detected. I’m not sure how well Hazel works if there is no ocr layer; you might want to experiment with this, which I have not done to date.
When you do the rename, you will rename “with pattern” and use the name you assigned to the custom date as part of the rename pattern. If you click on the variable, you get some options which you can actually use to rearrange the elements of the date, so if the date in the statement is in MM/DD/YY format but you want YYYY.MMDD (and you can let David and KatieFloyd battle out the ‘.’ for ‘-’ in the date!) you can do that.
It’s quite powerful, but one caveat: It is obviously tailored for an individual statement, so if the provider changes the statement format, you will likely have to modify the rule. You also want to ensure that your text detection pattern is such that the statement date is correctly chosen over any other dates that may appear in the statement, so you will want to examine the statement carefully and create the pattern accordingly.
Hope this helps.
Thanks, I managed to get this to work with 2 of the groups but am falling down on the one from Sprint. They put their statement date as a range like this “Bill Period: Aug 03 - Sep 02, 2018” and further down there is a last payment date in the format “Payment on 08/26”
If I set Hazel to deduce the date format and take the first one I get August 03. If I set it to the second one I get August 26. I can’t seem to get Hazel to understand the one in the middle Sep 02, 2018 as the one I want.
Will play a bit more but am open to suggestions. Here is what I am trying. A similar thing is working for my other statements.
I would suggest using Contents “Match Pattern” not contain match.
Make the pattern of the form:
Bill Period: aaa ## - (date)
Where a is match for any letter, # is a match for any digit and (Date) is a named custom date element of the correct format.
When you set up the date match, try starting the match with the hyphen.
OK Stupid Question. Hwo do I specify Match Pattern? My only choices in the dropdown in Hazel are
do not contain
do not contain match
Do contain match and then in the field you should be able to specify a pattern once you click into it.
Got it, it just took a bit. Hazel doesn’t seem very intuitive to me, I expect it to act more like a programming ;anguage and it doesn’t or at least not in a way I am familiar with.