Page 1 of 1

bug? following rule does not start, if rule before use ...

PostPosted: Tue Aug 23, 2016 3:25 am
by speedy_99
Hazel 4.05
Bug or feature?


The following rule does not start, if rule before uses trigger "contents -- contain match -- custom date dd.mm.yyyy"


e.g. rule 1 :!:

trigger:
1. "kind is pdf"
2. "contents -- contain match -- custom date"

action: e.g.
1. "rename or set color label or ..."


e.g. following rule 2 :!: it doesn't care what it handle

trigger:
1. "color label -- is -- green"


action: e.g.
1. set color label -- red


Problem

- Rule 1 works completely
- Rule 2 is not starting


Info

preview shows, that both rules should work
in "single mode", without a rule before, both are working correct

workaround

insert additional 3. trigger in rule 1 before "contents -- contain match -- custom date"
1. "kind is pdf"
inserted 2. "name -- contains -- any character of filename, e.g. A"
3. "contents -- contain match -- custom date"

Now the rules are working correct consecutively. Remember, the inserted rule is only a dummy for the workaround.

It's a bug or is there a error in reasoning?

Re: bug? following rule does not start, if rule before use

PostPosted: Tue Aug 23, 2016 11:52 am
by Mr_Noodle
I'm not sure if I follow your workaround. Do keep in mind that a file can only match one rule by default. If it matches rule 1, it won't ever get to rule 2. In such a case, you need to either re-order/re-structure rules or use the Continue action.

Re: bug? following rule does not start, if rule before use

PostPosted: Tue Aug 23, 2016 7:25 pm
by speedy_99
Hi Mr_Noodle,

thx for your answere.

probably my explanation is not clear enough.

Do keep in mind that a file can only match one rule by default. If it matches rule 1, it won't ever get to rule 2. In such a case, you need to either re-order/re-structure rules or use the Continue action.


I think I considered this. Only one rule fits.

Rule 1 changes the file in a way, that only the trigger of rule 2 fits.

e.g. tested rules. All rules in the same folder
if "ALL"
Rule 1 trigger "no color lable" --> action "set color lable" red
Rule 2 trigger "color lable" = red --> action "set color lable" green
Rule 3 trigger "color lable" = green --> action "set color lable" blue
Rule 4 trigger "color lable" = blue --> action "move" folder


My Rule 1:
if "ALL"
Trigger 1: Kind - is - PDF
Trigger 2: contents - contain match - custom Date

Action: Rename - (--proof-)-custom date
Stopp after rule 1

Workaround Rule 1:
if "ALL"
Trigger 1: Kind - is - PDF
Trigger 2: Name - contains - x ( x = random character )
Trigger 3: contents - contain match - custom Date

Goes to rule 2

MyRule 2:
if "ALL"
Trigger 1: Kind - is - PDF
Trigger 2: Name - contains - (--proof-)

Action: Move - folder


I hope my explanation is now clear.

Thx
Speedy

Re: bug? following rule does not start, if rule before use

PostPosted: Wed Aug 24, 2016 12:10 pm
by Mr_Noodle
I think the problem here with the original rules is that the renamed file still matches the first rule. By checking for that character (which I'm assuming is not there after the rename), you prevent it from matching that same rule again.

Re: bug? following rule does not start, if rule before use

PostPosted: Thu Aug 25, 2016 6:40 pm
by speedy_99
Sorry for asking again. Perhaps my bad english - I have to translate all to german - makes me a little bit dull-witted.


* The first rule that matches is the one and only one that is run.
* This means that if it finds a match, subsequent rules in the list are not looked at for that file. Note that this differs from how Apple Mail processes rules. If you want Hazel to continue evaluating rules for that file, you must use the "Continue matching rules" action.


To understand this, please correct my samples.

If "rule 1" and "rule 2" matches a file --> Stopp after "rule 1" --> must use the "Continue matching rules" action to run "rule 2"

If "rule 1" changes a file, so that it would match only "rule 2" and not again "rule 1" --> "rule 2" is working - "Continue matching" in "rule 1" not necessary :?:

The modifications of "rule 1", makes the original file a new file, so that "rule 2" is the first rule for the new modified file :?:

If it would be different, the following sample should not run :!: please correct me

e.g. tested rules. All rules in the same folder
if "ALL"
Rule 1 trigger "no color lable" --> action "set color lable" red
Rule 2 trigger "color lable" = red --> action "set color lable" green
Rule 3 trigger "color lable" = green --> action "set color lable" blue
Rule 4 trigger "color lable" = blue --> action "move" folder

Re: bug? following rule does not start, if rule before use

PostPosted: Mon Aug 29, 2016 1:55 pm
by Mr_Noodle
It looks like you have it right. If it doesn't work then use the preview and status functions (the latter is the "eye"button). Both of those should help to debug what's going wrong.

Re: bug? following rule does not start, if rule before use

PostPosted: Mon Aug 29, 2016 2:01 pm
by speedy_99
Hi,

the example with the colors is working, but it would be in opposite to " a file can only match one rule by default" "it won't ever get to rule 2"

Do keep in mind that a file can only match one rule by default. If it matches rule 1, it won't ever get to rule 2. In such a case, you need to either re-order/re-structure rules or use the Continue action.


Or is this
If "rule 1" changes a file, so that it would match only "rule 2" and not again "rule 1" --> "rule 2" is working - "Continue matching" in "rule 1" not necessary :?:

The modifications of "rule 1", makes the original file a new file, so that "rule 2" is the first rule for the new modified fil

correct?

Re: bug? following rule does not start, if rule before use

PostPosted: Mon Aug 29, 2016 2:03 pm
by Mr_Noodle
Both are true. A file can only match one file. It will be tested against the rules one by one, but only one can match (or possibly none).

Re: bug? following rule does not start, if rule before use

PostPosted: Mon Aug 29, 2016 2:10 pm
by speedy_99
thx for your support.

It doesn't care, that I do not understand completly.

Essential it works. :D