Ability to set time interval to run Hazel rule?

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

Moderators: Mr_Noodle, Moderators

Would it be possible to add functionality to set intervals for runnning individual rules?

Many of my rules don't need to be run more than once per 15-30 minutes or so and some once or twice per day for example.

thanks
bluloo
 
Posts: 10
Joined: Mon Sep 11, 2006 10:46 pm

Thu Jan 18, 2007 11:47 am • by Mr_Noodle
Need to think about it. Could you post some examples so I can get a sense of how you would use the feature? In general, Hazel is triggered by events and does not work on files in batch. There also may be a solution with the use of date attributes.
Mr_Noodle
Site Admin
 
Posts: 11251
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Fri Jan 19, 2007 9:43 am • by bluloo
Hi,

For example, if I want to move files over 30 days old from one directory to another, that rule only needs to be run once per day.

If I want to label or move files after I've installed them, it only needs to be run a few times per day (every hour or two perhaps?) or maybe every 15-30 minutes.

does that help?

thanks for the prompt response!

:)
bluloo
 
Posts: 10
Joined: Mon Sep 11, 2006 10:46 pm

Sun Jan 21, 2007 5:38 pm • by Mr_Noodle
I think you needn't concern yourself too much with when or how often the rules get run. For instance, in the "30 day old" case, files would be moved out as they hit the 30 day mark. Maybe I'm missing something but it shouldn't matter if it happens all at once or one by one. Basically, Hazel is always on the lookout and should not be particularly resource-heavy for you to notice that it's running.

Of course, if there are some other constraints let me know otherwise I say just set up the rules and not worry about when it happens.
Mr_Noodle
Site Admin
 
Posts: 11251
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

An example of the every X days rule Sun May 27, 2007 12:50 am • by jdrummey
As I grab pictures that I want to keep in iPhoto, I put them in a "pictures to import" directory. I have a recurring reminder to import the pics every couple of weeks. I also extensively use the Film Rolls function in iPhoto to organize images in my library.

When I have a rule set up on my "pictures to import" folder for pictures whose date added is not in the last two weeks, Hazel imports the pictures to iPhoto as expected, but one picture at a time. This leads to N film rolls for N pictures.

If Hazel could run on the whole folder at once, that might work, like checking based on last modified date of the folder. Or if Hazel could grab a bunch of files at once so the batch is sent to iPhoto as a Film roll, which is basically doing the same thing as a cron job.
jdrummey
 
Posts: 2
Joined: Sat May 26, 2007 11:44 pm

Mon May 28, 2007 9:52 pm • by Mr_Noodle
Unfortunately, Hazel doesn't really work in a batch fashion like that. But, you could write a rule to operate on the folder as a whole. In such a case, though, you will have to use your own script to do the actual importing.

I'll have to think about whether Hazel should do batch processing and if so, how it will present that to the user without confusing things.

For now, though, I think an Applescript is the way to go, or use cron. You could have Hazel move files into a folder and a cron job that will take all the files in that folder and import them wholesale.
Mr_Noodle
Site Admin
 
Posts: 11251
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mon May 28, 2007 10:44 pm • by jdrummey
I can see between cron, launchd, and Automator/iCal, there's already a lot of other batch options, so maybe trying to turn Hazel into the swiss army knife of doing things isn't the greatest idea.

I just got turned on to Automator, I think I'll use that for the batch processing, and Automator can do plug-ins to iCal alarms, which I'm already using a lot.
jdrummey
 
Posts: 2
Joined: Sat May 26, 2007 11:44 pm

Tue Sep 04, 2007 12:37 pm • by Peeja
Actually, we can do this now, as of 2.0. Use a "Date Last Matched is not in the last" rule to run actions more or less at an interval. (Really, this just guarantees *at least* a certain amount of time before the actions run again.) Note that if any actions fail for an item, that item will match again the next time through, regardless of the interval.

Most of the time it's best to write your rules more descriptively and let Hazel figure out when actions should be run, but when you need it this will work.
Peeja
 
Posts: 7
Joined: Thu May 31, 2007 4:34 pm


Return to Open Discussion