![]() |
|
|
|
|
|
|
|
|
WRITING FOLDER ACTION SCRIPTS Folder Actions are scripts, saved as compiled script files, containing one or more of the Folder Actions handlers from the the Folder Actions suite in the Standard Additions dictionary. These handlers correspond to each of the following manipulations that can be performed on an attached folder:
Folder Action Examples The following short script examples demonstrate the use of each of the five Folder Actions handlers found in the Standard Additions dictionary. Once a script containing one or more of these handlers is saved as a script file, it can then be placed in the Folder Actions Scripts folder in the Scripts folder to be used as a folder action.
1) When a folder is opened. When this routine is called, the variable this_folder will contain a reference, in alias format, to the attached folder. Ex.: alias "Mac OS X:Users:sally:Desktop:Shortcuts:" on opening folder this_folder end opening folder 2) When a folder window is closed. When this routine is called, the variable this_folder will contain a reference, in alias format, to the attached folder. Ex.: alias "Mac OS X:Users:sally:Desktop:Shortcuts:" on closing folder window for this_folder end closing folder window for 3) When a folder window is moved or resized. When this routine is called, the variable this_folder will contain a reference, in alias format, to the attached folder. Ex.: alias "Mac OS X:Users:sally:Desktop:Shortcuts:". The variable original_coordinates will contain the value of the bounds of the window before it was moved, Ex: {78, 355, 853, 740} on moving folder window for this_folder from original_coordinates end moving folder window for 4) When items are added to a folder. When this routine is called, the variable this_folder will contain a reference, in alias format, to the attached folder. Ex.: alias "Mac OS X:Users:sally:Desktop:Shortcuts:". The variable these_items will contain a list of alias references to the items that were placed in the attached folder. on adding folder items to this_folder after receiving these_items end adding folder items to 5) When items are removed from a folder. When this routine is called, the variable this_folder will contain a reference to the attached folder. Ex.: alias "Mac OS X:Users:sally:Desktop:Shortcuts:". The variable these_items will contain a list of the names of the items that were removed from the attached folder. on removing folder items from this_folder after losing these_items end removing folder items from |
TABLE OF CONTENTS Introduction Contextual Finder Menu - Setting up Folder Actions in the Finder Folder Actions Setup - A utility for administering Folder Actions Writing Folder Actions - How to write Folder Actions scripts Installed Scripts - A description of the installed Folder Actions scripts Example Scripts - Other examples of Folder Actions scripts |