smartly rename PDF documents

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

Moderators: Mr_Noodle, Moderators

smartly rename PDF documents Sat Jul 24, 2021 10:54 am • by jim80
So Hazel enables renaming PDFs based on identifying patterns in them, but is there a rule set that you use which renames a PDF "intelligently" (if the PDF does not match any specific rules before this catch all one that I am hoping can be created?

So this catch all rule can be such that it captures the first date in the document in any of the typical date formats, and then picks up headings based on PDF metadata and failing that PDF text that appears to be a heading of sorts and failing that just the first few words I suppose in the PDF.

Do share. Thank you!
jim80
 
Posts: 23
Joined: Tue Aug 28, 2012 5:47 pm

Re: smartly rename PDF documents Mon Jul 26, 2021 10:23 am • by Mr_Noodle
Please do not post questions to the Tips forum. It is meant for people providing tips.

You can always put a rule at the end which will get evaluated if none of the previous rules match but I'm not clear on what you are trying to do. You can have it grab the first date but don't know what you mean by picking up headings.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: smartly rename PDF documents Mon Jul 26, 2021 3:12 pm • by jim80
Mr_Noodle wrote:Please do not post questions to the Tips forum. It is meant for people providing tips.


I thought I posted this in the Open Discussion forum. Is it somehow posted in the tips forum?

Is there a rule that I can copy from somewhere that captures the first date in any format?
Further, is there a way to capture text that is presented in large font or bold format - am not so sure if PDFs allow such information to be accessed?

Then I would have this "intelligent rule" create a name with the "first found date" + "the first found text limited to 80 chars".

Thanks.
jim80
 
Posts: 23
Joined: Tue Aug 28, 2012 5:47 pm

Re: smartly rename PDF documents Tue Jul 27, 2021 8:38 am • by Mr_Noodle
I moved it here from the Tips forum.

If you do "Contents contain match (◦some date)" with the date attribute set to autodetect, that should grab the first date it sees.

You can't really grab text based on format as all that formatting info is stripped out when doing text matches. You'd need to do your own script which parses the raw PDF commands.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: smartly rename PDF documents Tue Jul 27, 2021 8:57 am • by jim80
Ok. Will try that.

Thank you!
jim80
 
Posts: 23
Joined: Tue Aug 28, 2012 5:47 pm


Return to Open Discussion