Page 1 of 1

Can a rule action pause Hazel for a few seconds?

PostPosted: Wed Mar 24, 2021 7:18 am
by MacOCD
Is there a way within a rule to get Hazel to wait a number of seconds before continuing to process any more rules in a folder (or even system wide if necessary)?

I've managed to automate the process of emailing invoices out in a robust way where there is no possibility of automatically emailing to the wrong customer.

Hazel wants to process all these PDFs and send all the emails at once and my mailserver is having a difficult time sending 20 or 30 emails out simultaneously.

I'd like to do the following for a folder of PDF documents:

1/ Rules to 1st PDF in the folder are met so run script to email it & then move it
2/ Don't process any more rules for X seconds to allow that to complete
3/ Rules to 2nd PDF are met so run script to email it & then move it
and so on.

Is this possible?

Thanks,
Mark.

Re: Can a rule action pause Hazel for a few seconds?

PostPosted: Wed Mar 24, 2021 9:25 am
by Mr_Noodle
You can do "Run shellscript" with a script like:
Code: Select all
sleep 5

where 5 is the number of seconds, which you can adjust as necessary.

Re: Can a rule action pause Hazel for a few seconds?

PostPosted: Wed Mar 24, 2021 11:42 am
by MacOCD
Each customer has a separate rule for the sending of their invoice.

This is because the script to email it is often slightly different customer to customer.

Some sent to a single email address, some to more than 1, some marked for specific person’s attention etc.

Sleep will pause the rule that has just emailed an invoice, but I want to prevent the other rules from emailing for a few seconds.

Any ideas?

Thanks

Re: Can a rule action pause Hazel for a few seconds?

PostPosted: Thu Mar 25, 2021 9:59 am
by Mr_Noodle
If they are all in the same ruleset, it won't matter. Files are processed sequentially so another file won't be processed until the previous one is finished.

Re: Can a rule action pause Hazel for a few seconds?

PostPosted: Thu Mar 25, 2021 10:10 am
by MacOCD
Hopefully be ok.

I’m sending invoices out tomorrow, I have around 15 to go.
I’ll see how it works.

Thanks.