Page 1 of 1

Something like "part of PDF content" to file name?

PostPosted: Sat Apr 24, 2021 9:40 pm
by halloleo
From one bank I get PDF statements which always have the same file name - without any date info in the file name.

The PDF content of course contains the date (range) of the statement. I somehow would like to extract the date (range) from the PDF content and add it to the file name

Can Hazel do this?

Re: Something like "part of PDF content" to file name?

PostPosted: Mon Apr 26, 2021 10:51 am
by Mr_Noodle
Yes, check out "match patterns" in the manual. That should show you how to match text/dates, put it in a custom attribute, and then use that custom attribute elsewhere in your rule.

Re: Something like "part of PDF content" to file name?

PostPosted: Tue Apr 27, 2021 12:42 am
by halloleo
Cool.I will try out "match patterns".

One followup question though: The text to match against comes from a PDF, and from the visual look of the PDF (tabular headings and numbers) it is not immediately clear to me in what order the headers and numbers appear to Hazel. Can I somehow look at the PDF's text extract which Hazel will use for the matching?

Many thanks for your help!

Re: Something like "part of PDF content" to file name?

PostPosted: Tue Apr 27, 2021 10:27 am
by Mr_Noodle
Text ordering in PDFs can vary wildly. If you use Hazel's preview function, click on the badge (checkmark or x) for the condition in question and it will show you the value for that condition, which should be the contents as Hazel sees them.

Re: Something like "part of PDF content" to file name?

PostPosted: Thu Apr 29, 2021 3:39 am
by halloleo
The preview does the job. Thanks.