Page 1 of 1

Variable avalible for the batch of files or argument?

PostPosted: Fri Jan 06, 2012 6:16 am
by markhunte
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

Re: Variable avalible for the batch of files or argument?

PostPosted: Fri Jan 06, 2012 1:19 pm
by Mr_Noodle
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.

Re: Variable avalible for the batch of files or argument?

PostPosted: Fri Jan 06, 2012 3:05 pm
by markhunte
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