How do you script a live watch/perform action folder?

I don’t know if this is possible. I want to know how to write a script that prints any contents that are put in a folder. Essentially I would create the folder, run the script, the script would wait (check every 15 minutes or so) for a document to be put in the folder, it will print that document (actually I would tell it to tell Photoshop to enable a print action I created), then it would move the printed document(s) to another folder…and so on and so forth.

Does applescript support this kind of “live” folder watching and perform an action accordingly.

Any help would be much appreciated.

Tangier Clarke
:wink:

What you want to do is entirely possible, and not hard at all.

However, what version of the Mac OS are you using?

That’s important because there are different ways of approaching this, depending on what you’re running.

For example, you could write a ‘faceless’ script that sits in the background, periodically checking the folder and opening/printing any files it finds.

However, Mac OS 9 introduced Folder Actions, which are scripts you ‘attach’ to a folder and get called any time items are dropped in the folder. This saves the hassle of having the scrpt running all the time in the background, and lets actions happen as soon as the files are dropped in, not some arbitrary time period later.

However, Mac OS 9’s implmentation had one serious flaw in that it would only work if the folder window was actually open when the files were dropped in - a serious limitation.

Mac OS X corrects this, though, and lets folder actions run any time files are dropped in a folder, even if the folder isn’t open.

So, depending on which OS you’re running, Folder Actions may or may not be the way to go.

I am running 10.2.4. I want to use your second idea of having the opperation happen whenever items are put in the folder. However, I also would have to move those files once the items have been printed so that the script doesn’t print the same things more than once.

Tangier

That is a frequent question here. There are three (or more?) solutions:

a droplet
a folder action
a timed script

Look how FolderOrg Script did it at
http://files.macscripter.net/ScriptBuilders/Finder-System/FolderOrg1.2.hqx

The first question of the Finder FAQ touches on it
http://macscripter.net/faq_finder.html

Unfortunately this ability has no settled name, so search the BBS for ‘add folder’ or ‘watch folder’. Many useful results will appear surrounded by many more non-useful results.

And there should be examples of Folder Actions on your computer installed when applescript was installed.

did you ever figure out how to do this, I don’t know how either and tried the search mentioned here but it did not help.

thanks