Page 1 of 1

Ignore Output File from Hazel Action

PostPosted: Tue Dec 23, 2014 2:31 pm
by jcmurphy
I have a few different Hazel rules that I am having trouble with and I am hoping someone has a suggestion. I am falling into a forever loop with the rule I have now.

The rules monitor a folder called "Action"
• looks for a Image or a PDF type file (if Kind is Image or if Kind is PDF)
• it also looks to make sure the file is not "brand new" (if Date Last Modified in not in the last 1 minute)
• if found then it runs an my AppleScript.

The Applescript takes the image or PDF and modifies it, creates a temporary file in the same location as the original file (in other words in the Action folder), then takes that file and modifies it again and creates a final PDF. Again the final PDF (the output PDF) is in the same folder as the original (the Action folder). The Applescript works OK when run as a stand alone script or app.

How can I get Hazel to ignore the temporary file and to ignore the output file for this one rule? I need the output file in the Action folder when done so it is available for a separate Hazel rule.

I tried "Ignore" but that only seems to work when it is the only item Action. And then it doesn't run my Applescript. I searched thru the forums for items related to "ignore" but I did not find a post that might help.

Is this possible?

Thank you!

Re: Ignore Output File from Hazel Action

PostPosted: Tue Dec 23, 2014 5:10 pm
by Mr_Noodle
You need some way of distinguishing that temporary file from the others. Since you are creating it, you have a lot of control over this. Use a naming scheme or tag the file and have the rules look for those indicators.

Re: Ignore Output File from Hazel Action

PostPosted: Tue Dec 23, 2014 5:58 pm
by jcmurphy
Hey Mr N - thanks for the quick replay. This helps - I will add the string "(temp)" to my temporary file name.

Will Hazel ignore the output file (the output file from my Applescript)? Or do I need some way of distinguishing that output file from the others?

Thank you!

Re: Ignore Output File from Hazel Action

PostPosted: Wed Dec 24, 2014 2:00 pm
by Mr_Noodle
You'll need to add a condition to the rule to not match files with "(temp)" in it. That should do it unless I'm missing something.

Re: Ignore Output File from Hazel Action

PostPosted: Thu Jan 22, 2015 8:00 pm
by Smudge
another option is to have the script create the temp files with the name starting with a period. Once it has finished processing the PDF, have the script rename to the final filename.

Hazel automatically ignores files that start with a period (and the Finder doesn't show them either) but when the script is done and renamed it to the proper filename, Hazel will see it and possibly trigger on your 2nd ruleset.