Saturday, June 24, 2017

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

julifos
Administrator
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:

Applescript:

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

Offline

 

Board footer

Powered by FluxBB

[ Generated in 0.032 seconds, 9 queries executed ]

RSS (new topics) RSS (active topics)