Variable avalible for the batch of files or argument?

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

Moderator: Mr_Noodle

Hi,

I want to process the whole batch of files moved into the folder Hazel is watching when using a shell script or Applescript.
At present I can only process each file one at a a time using the variables 'theFile' (Applescript ) or '$1' (shell)

But I when using a embedded Shell or Applescript I want to pass a list of all the files added at that time.
I know there should be arguments for all the files or input. But I cannot find them.

Can someone please tell me what they are

Many thanks
markhunte
 
Posts: 5
Joined: Fri Jan 06, 2012 6:00 am

There is no good way of doing this. Actually, there is a fundamental issue here. What constitutes a batch? Hazel can't know when when you are done adding files so there's no good way for it to trigger the batch operation. You can put in a delay or something but it may not always work, especially for big batches.

The best way to deal with this is to have whatever is adding the files trigger the batch operation since it knows when it's done adding.

Nonetheless, if you want to continue down this route, you will need to do it in two steps. One step is to mark the files that were added and another to then go through and process the files that are marked. You probably want to have the second step match the folder the files are in. An alternative is to move the added files to a special folder which then processes it's contents and then moves them back.
Mr_Noodle
Site Admin
 
Posts: 11289
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Hi,
Thank you for the reply.

Lol. I am what is adding the files :wink:

So Basically I should just add the files.
1, Hazel gets triggered.
2, in my applescript action I process the contents of the folder. And move the files out after processing them




The key being I process the contents of the folder, And I already move the files after processing. Just a shame I have to do it this way. And I cannot use this method for some task where I need a file list.

Thanks again
markhunte
 
Posts: 5
Joined: Fri Jan 06, 2012 6:00 am


Return to Support