Sample folder action scripts
The Mac OS includes several folder action scripts. These scripts are located in the Folder Action Scripts folder (in the Scripts folder inside the System Folder).
Note: Other sample scripts are in the AppleScript folder in the CD Extras folder on your system software CD.
The following sections describe each of the folder action scripts.
Scripts for when a folder is opened or closed
|
|
|
|
|
|
|
Script name |
|
Action |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
open-open items labeled 1 |
|
Opens any items in the folder that are labeled with the first label in the Label menu (in the File menu). |
|
|
|
open-show comments in dialog |
|
Shows any text in the Comments section of the folder's Info window. Lets you clear the comments or open the Info window for the folder. |
|
|
|
|
close-close subfolders |
|
Closes any open windows of folders within the folder. |
|
|
|
|
mount/unmount server aliases |
|
Mounts the servers when you open a folder, if the folder contains aliases to servers. Unmounts them when you close the folder. |
|
|
Scripts for when items are added to a folder
|
|
|
|
|
|
|
Script name |
|
Action |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
add-new item alert |
|
Displays a dialog box that lets you bring the folder to the front so that you can see what was added. |
|
|
|
add-reject added items |
|
Rejects items added to the folder and places them in the Rejected Items folder (located on the hard disk). Displays a dialog box stating that items cannot be added to the folder. You can also bring the Rejected Items folder to the front. |
|
|
|
|
You cannot attach this script to the root level of a disk. |
|
|
|
add-set view prefs to match |
|
Changes the view preferences of an added folder to match the view preferences of the attached folder. |
|
|
|
add-duplicate to folders |
|
Copies added items to other folders. |
|
|
|
|
To designate a folder to copy items to, put an alias of the folder in the attached folder and add "~!" to the first part of the alias name. For example: ~! Folder Remote. |
|
|
Script for when items are removed from a folder
|
|
|
|
|
|
|
Script name |
|
Action |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
remove-retrieve items |
|
Tries to return items to the folder when they are removed. If successful, a message tells you that items cannot be removed from the folder. |
|
|
|
|
This script may fail if the items are moved to a closed folder. |
|
|
Script for when a folder's window is moved or resized
|
|
|
|
|
|
|
Script name |
|
Action |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
move-align open subfolders |
|
Staggers the windows of any open folders in the attached folder. |
|
|
|
|
By default, the script always places the folders within the primary monitor. You can change the script if your computer has more than one monitor. |
|
|
Related topic
|