Delay processing of different files in a folder

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Delay processing of different files in a folder 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!!
Skeo
 
Posts: 31
Joined: Mon Jan 02, 2012 7:53 pm

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.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

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
Skeo
 
Posts: 31
Joined: Mon Jan 02, 2012 7:53 pm

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
puffykb
 
Posts: 1
Joined: Sat Sep 14, 2013 4:54 am

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.
Skeo
 
Posts: 31
Joined: Mon Jan 02, 2012 7:53 pm


Return to Support