It would be cool (though maybe complicated?) to have the following:
1) for each rule, have a list of patterns that are "captured". by default, the list of captured patterns would be all the patterns in the rule (so by default it would act like option (c)). But you can remove patterns from the captured list which will mean the pattern will need to be matched, but you won't update the captured value (so you could do something like option (a)).
2) introduce a pattern capture reference. So now we have (•pattern) to match (and possibly capture) the pattern, but add a (=pattern) reference so that it uses whatever captured value you currently have in (•pattern).
So your example could be something like:
- Code: Select all
If (all) match
Name matches (•blah) [and captures blah]
Extension is "bleh"
If (all) match for (enclosing folder)
If (all) match for (any sub-file)
Name matches (=blah)
Extension is "boo"
I don't think this is too complicated, it explicitly conveys what the rule is trying to do without people having to know the underworkings of hazel.
Your first example could be any of the following:
- Code: Select all
If (all) match
Name matches "(some other pattern)(•pattern)(...)" [and captures pattern]
Name matches "(yet another pattern)(•pattern)(...)" [and captures pattern]
Rename file (=pattern)
- this would be the default behaviour and rename the file to the second pattern match
- Code: Select all
If (all) match
Name matches "(some other pattern)(•pattern)(...)"
Name matches "(yet another pattern)(•pattern)(...)" [and captures pattern]
Rename file (=pattern)
- this would also rename the file to the second pattern match
- Code: Select all
If (all) match
Name matches "(some other pattern)(•pattern)(...)" [and captures pattern]
Name matches "(yet another pattern)(•pattern)(...)"
Rename file (=pattern)
- this would rename the file to the first pattern match
This would mean that the matching, capturing, and referencing the results of a pattern need to be separated out into separate things. But perhaps there is an easier way to do this?