Rename file based on conditional contents

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

Moderator: Mr_Noodle

Rename file based on conditional contents Wed Jan 08, 2014 6:53 pm • by odornd
To make things easier I'll give my example and go from there.

Say I have a bill in PDF form from an insurance company. I want Hazel to look at the contents and see if my bill is an Auto Policy, House policy, Life policy, etc. I know how to search for those things, but what I'm curious about is naming the file based on what Hazel finds. If it is an Auto Policy, I would like that in the name, etc. I guess I could do this in multiple rules, but if I could do it in a single rule that would be great. Possible?

Maybe an apple script would work, but I'm not very familiar with using it.
odornd
 
Posts: 3
Joined: Wed Jan 08, 2014 6:45 pm

Is the text "Auto Policy" in the contents? If so, you can store that in a custom token. Otherwise, if you are just looking for some text that you don't want in the name, but distinguishes the document as an auto policy, then you will have to do separate rules or a script at the moment.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rename file based on conditional contents Sat Jan 11, 2014 3:19 pm • by odornd
The string "Auto Policy" is in the contents and I do want it in the name. My goal is something like this...

Search the document for contents containing the string, "Auto Policy", or "House Policy", or "Life Policy". Store the one that Hazel finds as a token for use in the name.
odornd
 
Posts: 3
Joined: Wed Jan 08, 2014 6:45 pm

You can try using "Contents contain match" and use a custom token to match some text and then the word "policy". You can then use that custom token in a rename action. Search for "match patterns" in the help.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support