Capturing patterns in a nested "OR" condition?

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

Moderator: Mr_Noodle

Hi --

I'm trying to instrument Hazel to rename PDFs based on their contents. In particular, I would like to match a collection of documents that only vary by a few meaningful variables that I'd like to capture and include in the filename.

An example would be PDFs for car insurance statements for a multi-car household, where each car has its own insurance. I'd like to capture the name of the car (e.g. "2001 Toyota Prius" or "2013 Honda CRV") and include that in the filename. Since only one of these would occur in a given PDF, I've used a nested condition with an "If any" clause:

Image

My assumption was that the new filename would contain either "Prius" or "CRV", because only one of the two variables (Model1 and Model2) would match and have a value. Instead, all the new filenames contain "PriusCRV":

Image

The XXX and YYY above reflect different account numbers for the statements, so the matching is occurring correctly. I expect the "PriusCRV" issue is because Hazel is matching many files and the variable names persist across the matches.

Is there a better way to do this, preferably in an extensible way so that additional nested conditions could be added to capture other matches?

Thanks in advance,

Ramon
felciano
 
Posts: 22
Joined: Sat Feb 23, 2013 5:44 pm

The matching shouldn't extend beyond that rule. Try using the preview function to view what values the custom attributes have.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Yup that did it. Turns out there were multiple matches in the document. A simple increase in pattern specificity fixed it.

Thanks for the quick response!

Ramon
felciano
 
Posts: 22
Joined: Sat Feb 23, 2013 5:44 pm


Return to Support