Monday, July 4, 2022

#1 2005-10-11 01:56:04 pm

From:: Malasaña, Madrid
Registered: 2002-11-20
Posts: 2014

What is a folder action and how do I use one?

Folder Actions are special scripts which can be attached to any folder that force events to take place when items are added or removed from that folder. Events can also fire when the related folder is opened, closed or moved. In pre-OSX systems, the folder had to be opened in order to respond to events.

Here is a simple example script:


on adding folder items to thisFolder after receiving addedItems
   repeat with anItem in addedItems
       tell application "Finder"
           set comment of anItem to "Hello!"
       end tell
   end repeat
end adding folder items to

When attached to a folder, this script would change the comment of anything added to it to "Hello!". Now save your script and attach it to a folder (read in this same category "How do I attach a Folder Action to a folder?") and you are done!

Filed under: Finder



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)