• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 14. AppleScript > Folder Actions

14.4. Folder Actions

A folder action is a behavior that occurs automatically when certain events take place in a designated folder in the Finder. Folder actions aren't implemented as application, but as scripts with certain handlers which, if present, are called when the corresponding event takes place. For example, when applied to a folder, the following folder action script displays a message whenever files are moved or saved there:

on adding folder items to this_folder after receiving these_items
    tell application "Finder"
        set this_name to the name of this_folder
    end tell
    display dialog ((the count of these_items) as string) & ¬
        " items have been added to folder "" & this_name & ¬
        ""." buttons {"OK"} default button 1
end adding folder items to


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint