Perform multiple rules on one file

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Perform multiple rules on one file Thu Aug 04, 2011 8:22 am • by jgarnham
At the moment Hazel stops processing a file when it successfully matches a rule, however I don't want this, I need Hazel to keep going through the other rules. For example, I have two rules which could both match the same file. The first matches if, for example, the title contains 'hello' and the second matches if the contents contain 'welcome'. The problem is they could both match the same file but only the first rule would do its work.

Is there some way to make Hazel keep going through the other rules even if it has matched one already to the same file OR can I make one rule call/start/do another?
jgarnham
 
Posts: 3
Joined: Thu Aug 04, 2011 8:17 am

Re: Perform multiple rules on one file Thu Aug 04, 2011 12:24 pm • by Mr_Noodle
There is no way to do that now. You would have to structure your rules in such a way that all the actions would happen within one rule.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

If you want the results applied from both rules to the same file you could set a condition that makes a delay in the second rule. I have some rules that wait 5 mins after the files creation date to give other rules time to run. I also believe you could use (I think you could any way, i'm on an iPad so I can't check.) the date last matched rule to create the delay. I've also heard of people using color labels as an indicator to hazel that the file needs more hazel goodness.

The down side to this if you have files that only contain one of the two conditions, it complicates things. It can be done but it may take 4 rules to process those two files. One to deal with them both. (delay) One each to deal with them separately. And you might need one more rule to make sure they don't get matched over and over again, depending on what you are doing to the file. This could be done before or after the other rules depending on how you want to design the rules. You will need to make use of file title contain and do not contain to make this work.

But if you need the files to be matched by more then 2 words it starts to get so complicated it might not be worth the pain involved in figuring it out.

More specifics on what you are trying to do might help me in pointing you in the right direction.
justinkthornton
 
Posts: 26
Joined: Wed Aug 03, 2011 11:50 am

Re: Perform multiple rules on one file Thu Aug 04, 2011 2:11 pm • by jgarnham
Thanks for the post, to give you some more info I'll tell you what the rules are doing:

Rule 1 :
- If 'contents' contain 'App'
- Then set 'label' to red

Rule 2 :
- If 'name' starts with 'SD'
- Then move to '~/Desktop/Stuff/AppStuff'

As you can see both could apply to the same file.
jgarnham
 
Posts: 3
Joined: Thu Aug 04, 2011 8:17 am

Thy this:


First Rule

If 'contents' contain 'App'
If 'name' does not starts with 'SD'

then
set label to red

Second Rule

If 'contents' do not contain 'App'
If 'name' starts with 'SD'

Then move to '~/Desktop/Stuff/AppStuff'

Last Rule

If 'name' starts with 'SD'
If 'contents' contain 'App'

Then move to '~/Desktop/Stuff/AppStuff'
Set Color Label to Red.

It should work, but test it first.
justinkthornton
 
Posts: 26
Joined: Wed Aug 03, 2011 11:50 am

Re: Perform multiple rules on one file Fri Aug 05, 2011 2:51 am • by jgarnham
Ah, that works great. Thanks very much!
jgarnham
 
Posts: 3
Joined: Thu Aug 04, 2011 8:17 am

Re: Perform multiple rules on one file Tue Nov 15, 2011 1:59 pm • by xor2000
Hi,

it seems to me that there are quite a few posts regarding how to work around the feature that Hazel will stop running rules on a single item (file/folder) after it found the first matching rule.

I understand the benefits of this design decision but also find it very limiting: performing a complete set of condition/action rules on all files/folders as in the example above seems to me like one of the most natural tasks for Hazel but it is currently very hard to set up.

On the other hand, I think the idea brought forward by Mr_Noodle some time ago would be a very good solution: to introduce a new action "Run next rule on this item". This would not break existing rules but make tasks like the above much easier to setup.

To further reduce potential for confusion: how about making a final action mandatory in each rule: it would always be present and could only be set to:

"Run no further rules on this item" (which would be the default), or
"Run next rule on this item"

Also, the "Rules" list for a folder could then indicate if the last action in a rule is set to "Run no further rules on this item" or "Run next rule on this item", for example by displaying a solid dot (or stop sign) or a down arrow, respectively, behind the rule name.

I think this really would help.

Thanks for listening!
Olaf
xor2000
 
Posts: 13
Joined: Mon Oct 17, 2011 4:54 pm

Re: Perform multiple rules on one file Tue Nov 15, 2011 6:08 pm • by Mr_Noodle
Thanks for the feedback. I suggest giving concrete examples. Doing so makes it clear what it is you are looking for and helps me to shape the feature. In general, it's always better to be specific about the problem instead of suggesting possible solutions.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Perform multiple rules on one file Tue Nov 15, 2011 6:31 pm • by xor2000
Mr_Noodle wrote:Thanks for the feedback. I suggest giving concrete examples. Doing so makes it clear what it is you are looking for and helps me to shape the feature. In general, it's always better to be specific about the problem instead of suggesting possible solutions.


Sure, consider for example one of the first things I was trying to setup:

In my Downloads folder, I would like to:

1. Label every new file/folder (created <= 1 day) green
2. Unlabel every non-new file/folder (1 day < created <= 4 weeks)
3. Label every old file/folder (4weeks < created) red
4. Rename every file/folder according to the following scheme (e.g.: "New.File_2011.txt" -> "New File 2011.txt"):
"." -> " "
"_" -> " "
5. Move every file of kind movie to my Movies folder
6. Move every file with extension ".txt" to my Documents folder
7. Apply the rules recursively to any folder

If rules would allow to continue down the rule set after a match I could just set up these 7 rules as stated above I would assume. As it is now, there is no easy way to set this up (though it is possible in principle of course).
xor2000
 
Posts: 13
Joined: Mon Oct 17, 2011 4:54 pm

Re: Perform multiple rules on one file Tue Nov 15, 2011 11:06 pm • by tc60045a
justinkthornton wrote: I have some rules that wait 5 mins after the files creation date to give other rules time to run.


That is genius -- love ya for submitting that, mate. Solves a challenge with RipIt that I was anticipating. Awesome.
tc60045a
 
Posts: 9
Joined: Tue Nov 15, 2011 10:55 pm

Re: Perform multiple rules on one file Wed Dec 18, 2013 7:55 am • by musecaptain
Hi Mr. Noodle,

Another vote for being able to perform multiple rules on one matched item.

It would open the doors for so many new uses for Hazel. You could do automated file checkers for all kinds of files, video files, audio files, photos, documents, delivery workflows as well as even more advanced actions.

I’ll provide an example. I’m trying to automate a video processing workflow, where I’m be able to take a folder “Project” consisting of 3 folders: Video, Audio and Graphics.

The folders contain these files:
Graphics: PSD files - those should be in RGB Color mode, be in 1920x1280 resolution etc.
Video: Video files - those should be Prores 4444, wrapped in a QuickTime wrapper, with a resolution of 1920x1080, 24 bit audio etc. etc.
Audio: Audio files - 24 bit, 2 channel, uncompressed audio, in AIFF format etc.

With the current version of Hazel it’s not possible to have Hazel go through this complete folder hierarchy, tag the files with errors (based on what doesn’t live up to the specs), and then move the complete checked folder to a specific destination.

Hazel will only tag the file with the first error it finds and then stop checking for more (because of the lack of a multiple rule matches feature). And I’m trying to make it rename each file with all the errors it finds.

It is possible to work around this by moving a single file (for instance a video file) from one folder to another (where Hazel then runs a different check in each folder and moves the file to the next) - for instance with foldes named “Video Codec”, “Video Resolution”.
See this setup: http://cl.ly/image/3Q060z1s2l2L
An example checking rule (Audio Codec): http://cl.ly/image/262Z461c113m
The Finished rule: http://cl.ly/image/2P181q2N0P3K

However this only works with one single file. Checking only one file at a time by dragging it into a folder, waiting for it to be checked and then moving it back into the folder structure, is not an option and defeats the purpose of this automation workflow (as you still have to spend time moving files around, which introduces user errors and such - one might as well check the files manually as the time saved is lost again).

However the above workaround could have worked for a complete folder structure if it was possible to, in the same rule, to run the action not only on the matched files, but also on one of the folders containing a matched file (another general feature request). But still the most intuitive and simple way of accomplishing the above it seems, would be if one could a checkbox for simply enabling multiple rules to trigger, instead of stopping after the first.

This would help break through many of the limitations in file checking and delivery workflows for all kinds of projects. I hope my explanation makes sense.

The implementation suggested by “xor2000” sounds excellent b.t.w.

Anyway, consider this a major feature request from me. I can imagine a lot of companies could use this in their workflows and there seems to be no competing alternative in the market, that does this at a reasonable cost.
musecaptain
 
Posts: 27
Joined: Tue Oct 08, 2013 2:38 pm

Re: Perform multiple rules on one file Thu Dec 19, 2013 1:58 pm • by Mr_Noodle
Thanks for providing an example as that is far more helpful than anything else. Check the Open forum as I'm posting a thread there where I'll need some questions answered on this feature.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Perform multiple rules on one file Tue Mar 18, 2014 5:05 pm • by mlevison
Another call for multiple rules being triggered for one file in a folder.

I share my training material with different groups of people for different reasons.

Each group should get its own named rule. Each rule should fire different actions:

#1 Course Attendees Dropbox should be updated with the latest version of the course materials everytime I save a PDF. (This is the reason I purchased Hazel)
...#1a Exception - we don't copy the test handout

#2 Trainer Partners get a copy of all handouts to print, but not presentations (as they would likely try to print them too).

#3 Other Trainers get a readonly copy of my material via dropbox - this is a whole folder copy with the .git files dropped

As you can see each group has slightly different needs. I'm sure I could jam it all into one rule but that won't make sense to a future me that has to figure why I did what, especially when I upgrade to a MacBookAir/Pro with more SSD space.

Does that help clarify the need?

Cheers
Mark
mlevison
 
Posts: 15
Joined: Thu May 30, 2013 11:49 pm

Re: Perform multiple rules on one file Thu Mar 20, 2014 12:51 pm • by Mr_Noodle
Can you post in the thread in the open forum on this? When doing so, elaborate on the rules as I'm not sure what those categories are, if there is overlap, and how you determine that from the file.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support