Page 1 of 1

Delay processing of different files in a folder

PostPosted: Sun May 20, 2012 1:50 pm
by Skeo
Just wondering if there is a way to delay the processing of sequential files that match a rule?
I have an "a better finder rename" droplet that is set to make files windows safe so they can be moved to a network drive.

The rule is:
Code: Select all
if ......blah blah.....
then open with "droplet"

Currently, if multiple files are matched simultaneously, only the first one will hit the droplet, because hazel sends all the files one after the other before the droplet has the time to finish loading the first one (which only takes about 2 seconds).

So basically, Im looking for some way to make hazel wait a few seconds before processing each of the matched files. I tried adding a "delay 30" applescript to the rule, but it didn't make any difference. Seems each file is matched and run regardless of if the rules for the file before it have finished running.

Ageing rules obviously won't work, because then the first file would be delayed by the same amount and I'd hit the same problem, just a little delayed.
I also tried opening the file with an applescript and building in a delay, but I can't get applescript to work nicely with an open command and the droplet.

help please!!

Re: Delay processing of different files in a folder

PostPosted: Mon May 21, 2012 11:23 am
by Mr_Noodle
Pausing in a script should work. Not sure about the AppleScript delay thing but you can do a shell script as follows:
Code: Select all
   sleep 30


If it's still not working, then something else is going wrong. You need to check the logs to see what's going on then.

Re: Delay processing of different files in a folder

PostPosted: Fri Jun 08, 2012 4:11 am
by Skeo
I have very little experience with shell scripts.
I accidentally put sleep 30 in an applescript and it just put my computer to sleep everytime the rule ran.
Got it working with this applescript in the end

Code: Select all
tell application "Finder"
delay 10
end tell

Re: Delay processing of different files in a folder

PostPosted: Sat Sep 14, 2013 5:09 am
by puffykb
Hello,

I am having the same problem.
Im receiving several image files from dropbox at the same time, that i want to open with a Photoshop droplet.

So hazel open all files at the same time with the droplet, getting only one file processed.

The delay finder applescript you mentioned only delayed the initial action by 10 seconds.

Could you give me more details on how you solved your problem?

Thank you

Re: Delay processing of different files in a folder

PostPosted: Sun Sep 15, 2013 5:41 am
by Skeo
Hi,

My rules are working nicely now.
I added an applescript delay to the end of the rule and it won't run the rule on the next file until delay is finished.

Looks like:

if ....whatever....
then open file with droplet
run applescript

the embedded applescript is then simply "delay 30" or whatever time in seconds your droplet takes to run.
if that doesn't work you could us the tell finder syntax I posted before, or you could use "sleep 30" in a shell script.

just make sure that this is the last thing you have the rule do, so it will process the file, then wait, then process the next one.