Page 1 of 1

Using applescript to generate email response

PostPosted: Thu Jun 06, 2019 2:10 pm
by lynwyn
Hi. I set up rules to generate an notification email when images are added to a folder. However, it generates one email per image, and I only want it to send one per batch of images. Any suggestions?

Re: Using applescript to generate email response

PostPosted: Fri Jun 07, 2019 10:05 am
by Mr_Noodle
How do you define a batch? If it's all the images in a folder, you can instead match that folder (you'll need to have Hazel monitor the folder that contains it).

Re: Using applescript to generate email response

PostPosted: Thu Jun 13, 2019 3:30 pm
by lynwyn
I wanted it to be all the newly added images, however, I generate images into a temporary folder that Hazel monitors and then moves to the appropriate final folder when rules are matched. I assume if I do the correct order of the rules, this can work from the temp folder?

Re: Using applescript to generate email response

PostPosted: Fri Jun 14, 2019 10:21 am
by Mr_Noodle
Note that Hazel has no notion of what you consider a batch. If it's every file in a particular folder, how would you know whatever is generating the files is done? Can you go off of some delay after the last time a file was added? Is there some other indicator you can use?

Re: Using applescript to generate email response

PostPosted: Fri Jun 14, 2019 1:43 pm
by lynwyn
Batches take less than 10 minutes to create and occur once a day. It's not clear to me how to break this out so it only send one email. It would be nice, but it sounds like perhaps it is not capable of being done.

Re: Using applescript to generate email response

PostPosted: Mon Jun 17, 2019 10:27 am
by Mr_Noodle
If it's once a day, you could use "Current time" to schedule it.

Re: Using applescript to generate email response

PostPosted: Mon Jun 17, 2019 4:16 pm
by lynwyn
I added Current time is after 4:00PM on a weekday and it continues to send one email per image, so I must not be understanding your instruction

Re: Using applescript to generate email response

PostPosted: Tue Jun 18, 2019 10:19 am
by Mr_Noodle
You still need to match the folder as a whole and not each individual file. Have Hazel monitor the folder that contains those files and have the rule then match that folder (the one containing the files).

Re: Using applescript to generate email response

PostPosted: Tue Jun 18, 2019 3:46 pm
by lynwyn
I don't think this will work, it has to look at the metadata in the file to send the email to the correct person. Thanks for your help

Re: Using applescript to generate email response

PostPosted: Wed Jun 19, 2019 10:23 am
by Mr_Noodle
What metadata do you need to access? Do all the files in a folder have the same recipient? Can you post your rule as it stands now?