[feature request] add if / else statements

Talk, speculate, discuss, pontificate. As long as it pertains to Hazel.

Moderators: Mr_Noodle, Moderators

[feature request] add if / else statements Thu Sep 08, 2016 2:33 pm • by nikivi
I think this has been asked before already but for me personally now that I am starting to use Hazel I would really love to make more complex rules rather than a bunch of single purpose rules. One of the reasons for that is trying to keep the amount of rules that I have lower and also have much nicer rules to work with. For example I have this rule :

https://i.imgur.com/LTP4J0X.png

Let's say I want to have files that 'is' data structures and contains 'slides' for example to do something else with it. Right now I need to go on and create a new rule for that. It would be nice if I can chain things and group them together.

For this case now that I think of it, I can just create a rule set in the folder the file will be moved to but then again I will need to have a rule for each of the moves I want to make. What are your thoughts on if / else? I can see the value of having simple rules but being able to organise them would be really nice in my opinion.
nikivi
 
Posts: 39
Joined: Tue Mar 08, 2016 10:04 am

Well, if/else the way you want it would be very complex in this case. You want it to only apply to particular conditions in the rule and not others. Specifying a way to do that in the UI would be pretty complicated and I think of limited use.

You can partition rules by using things like tags to break them up into phases. Like the first condition can set a certain color. It also can use the "Continue" action to allow rule evaluation to continue to the next rules. The rules after that can look for that color and check for additional conditions. This has the same effect without cramming all sorts of extra control structures into a single rule.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Open Discussion