Feature Suggestion: Allow Rules to Pass Files to Other Rules

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

Moderators: Mr_Noodle, Moderators

Ina support post, Mr_Noodle had this to say:

Mr_Noodle wrote:Note, though, that I would consider the inverse action of the "Stop evaluating rules" which would be something like "Continue evaluating rules". I'd have to think about it a bit and can't say if/when it would go in but if this is something I'll consider. Any feedback appreciated.



I don't think that this would be necessary if we could selectively assign any file attributes to variables. Currently, there are workarounds in file/folder naming, but the quote above attempts to address the problem of multiple rules matched for a file in sequence. For at least my purposes, the addition of variables would be handy.

This probably would be moot with OpenMeta, but its a thought.

EDIT: Subject changed.
Last edited by a_freyer on Mon Jun 29, 2009 12:11 pm, edited 2 times in total.
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Are you aware of the pattern matching/custom token feature? Check it out in Hazel's help if not. Just think of custom tokens as variables.

Albeit, they only apply within the scope of a single rule. I'm not sure what kind of connection you are tying between the two features. If you could post a concrete example, I can get a better sense of what you are trying to do.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Yes, I am aware of the pattern matching feature - in fact I use it in most if not all of my rules.

What I am referring to is the problem present by the originally mentioned post - http://www.noodlesoft.com/forums/viewtopic.php?f=4&t=531&p=2035

Here, the OP is citing an issue that my mulitple-folder workaround means to fix. And yes, in part, this could be solved with passing variables between rules as you mention. Here is an example of a sequence of rules I have running on my downloads folder:


    1) If this filename indicates it is from a university class based on class and section, sort it into the proper subfolder

    2) If this file's source URL indicates it is from a university class, rename the file with class and section

    3) If this file is a document, move it into the documents folder

    4) If this is another kind of file, sort it into a Type-based subfolder within the folder Misc.

Ok, now, I know that I could rename and refile university class files from within the second rule - but then if I decide that I want to turn off university class sorting for a period, I would have multiple rules, instead of a single rule, to remove. Similar benefits come from a single file when debugging a rule. I think that it is more efficient to have rules accomplish one thing - and accomplish them well instead of having multiple rules just for the purposes of redundancy.

My original suggestion of assigning file attributes as variables is moot with OpenMeta. No problem there, but now I have a better suggestion, one that perhaps makes more sense:

Allow rules to pass files to ANY other rule, based on matching conditions. In addition to running rules sequentially, if we could pass files from one rule to another, files could be processed much more efficiently and quickly. An example:


    1) If this filename indicates it is from a university class based on class and section, sort it into the proper subfolder

    2) If this file's source URL indicates it is from a university class, rename the file with class and section and pass to "University Class Sort" rule

    3) If this file is a document, move it into the documents folder

    4) If this is another kind of file, sort it into a Type-based subfolder within the folder Misc.

Is this suggestion more clear? Would the addition of rule-passing be of use to anyone else?
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

If I understand your flow correctly (which is probably a shaky proposition), if there were a "Continue" type action, you could have rule #2 come before rule #1. I believe this would give you what you want.

Also, in some future release, there will be nested conditions so you can do "A and (B or C)" which would also help in consolidating some rules (though I'm not sure if this helps your current case).

Nonetheless, the more examples you can give the better as it helps to have something concrete to go against.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

I think that the "passing" feature would be useful if most users programmed Hazel like me, by treating rules more like functions.

Often I have found that I copy useful and well-written rules from folder to folder. Either that or I funnel certain files to a specific folder. Being able to pass a file DIRECTLY (as opposed to setting metadata or filename flags) to another rule would be useful is these cercumstances.

Perhaps my concept isn't being explained well. The best analogy I can come up with is Functions or Methods in programming. Each are specifically taylored to do one this well, and they can all be used by any other Function or Method.
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

While with Hazel, you are essentially "programming" it via the rules, I want to make sure it doesn't actually feel like programming. In this case, I want to minimize the number of executions paths you would have to trace through to debug your rules. Hopefully I can come up with something that will address your cases while at the same time not complicating things too much.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Open Discussion