Latest in Applescript

Image credit:

AppleScript: Exploring the power of Folder Actions, part II

Cory Bohon

In the last AppleScript post, I mentioned some of the useful ways to create Folder Actions, and showed you how to use one of the built-in scripts to perform a pretty useful action. In this AppleScript post, we'll dive into the built-in scripts in more detail, and I will tell you how each of them works.

Once you create a new folder action (as we did in the last tutorial), you will have a pop-up dialog asking if you would like to attach an Apple-created script. There should be around 13 preinstalled on your Mac. Now let's go through each of them, and see what they will do when attached:

Add-new item alert.scpt - This included script, which we covered in the last post, allows you to get a pop-up dialog upon dropping files in the attached folder. So, if you were to drop file x into the folder, a dialog would display a message that file x was just dropped in there. This script is great for networked folders, as you get a dialog when someone drops something in there.

Close-close sub-folders.scpt - This script will, when a file is dropped in the attached folder, close all opened Finder windows associated with that folder and subfolders. So, if you have that folder opened, or another subfolder within that folder, when you drop a file into it the script will close those opened Finder windows. You can use this script to tidy up your screen.

Convert-PostScript to PDF.scpt - If you have a PostScript file type (i.e. eps or ps files), then you can enable this folder action. When you drop a PostScript file on it there will be two folders created, one called "Original" and the other called "PDF." This folder action will take those PS files and turn them into PDFs for your instant viewing pleasure. You can use it in your workflow to easily convert from PS to PDF.

Read on to learn about even more built-in folder action scripts.

Image-Add Icon.scpt - The script will create an icon for each image file, based on the contents of the document.

Image-Duplicate as JPEG, PNG, TIFF.scpt - In each of the three scripts, when you drop an image file on the folder, the action will duplicate the file as either a JPEG, PNG, or TIFF. If you drop either of the output file types on the folder, the images will not be duplicated. This could be attached to a folder that you could use to easily convert between image file types.

Image-Flip Horizontal/Vertical.scpt - With these two scripts, you can easily flip an image horizontally or vertically when an image file is dropped on the folder.

Image-Rotate Left/Right.scpt - These two scripts allow you to flip a dropped image file either left or right.

Image-Info to Command.scpt - This script adds information about the image to the Spotlight comments field. Once this information is entered, you can view the comments by choosing "Get Info" on the image in the Finder (or in conjunction with the next script).

Image-Show comments in dialog.scpt - This script will pop-up a dialog box that contains the information contained in the attached folder's Spotlight Comments field. This script can be used along with the Info to Command script that was mentioned directly above.

And there you have it, a description of the 13 included folder action scripts. In the next AppleScript post, I'll walk you through creating your own custom folder action scripts.

From around the web

ear iconeye icontext filevr