Page 1 of 1

If.. Then.. Way of Setting a token/variable for use in file

PostPosted: Fri Mar 07, 2014 7:30 am
by philrob
This could be done with two rules, but would be neater if I could just use one.

I am using hazel to rename and file share pdf contract notes. They contain the text 'Buy' or 'Sell' in a box on their own.

Date matching, account number matching on the PDF works fine.

What I would like to do is get the words 'Buy' or 'Sell' into the file name so format is something like this:

yy-mm-dd - Contract Note - Buy.pdf

or

yy-mm-dd - Contract Note - Sell.pdf

In reality the filename is a bit more complicated than that (in case there is more than one transaction a day).

It could be done with two rules but is there a way to do it with one?

Thanks

Phil

Re: If.. Then.. Way of Setting a token/variable for use in f

PostPosted: Fri Mar 07, 2014 3:18 pm
by Mr_Noodle
You could try using a single rule with two conditions. Each condition can match either pattern and use "any" so that only one needs to match. You can then use the custom tokens from both in the rename pattern. Only one will have a value at a time.

In the future, I'm considering adding the ability to have multiple patterns associated with a custom token, which would make this type of thing much more compact. There are also other implications but overall, things would end up a bit cleaner.