Re: how to set folder action
Re: how to set folder action
- Subject: Re: how to set folder action
- From: Mr Tea <email@hidden>
- Date: Mon, 24 Dec 2001 01:31:59 +0000
This from Webmaster at @077 on Sun, Dec 23, 2001
>
How do I tell the script to run whenever a file is added to the folder?
Wrap it in this...
on adding folder items to theFolder after receiving theItems
--your script here
end adding folder items to
..then control click on the folder you want to attach the script to,
select the 'attach folder action' option, and navigate to your script in
the resulting 'open' dialog. (Folder Actions will then place an invisible
alias to the script in that folder.) The script snippet above contains
two variables: theFolder - a reference to the folder the action is
attached to; and theItems - which can refer to either a single item saved
or dragged into the folder, or a list of items when multiple files/
folders are dragged.
Some caveats:
The folder must be open (but can be collapsed to a pop-up tab) for the
action to work.
Folder action error messages are notoriously indecipherable, giving
oblique numerical error references instead of plain info. I think you can
find a key to what these numbers mean in the AppleScript Language Guide,
but you may want to put in an error handler that displays a more
immediately useful dialog, at least during the testing stage...
HTH (& MC & HNY)
Mr Tea
--
"Always remember to warm the pot."