“Attaching” Workflows to Volumes

Have you ever wanted an Automator workflow to run automatically every time a certain drive is mounted on the Desktop? Here's an easy way to make that happen, just follow these steps:

STEP 1: Install the Check for Disk Action

The Check for Disk action will check to see if disks matching the indicated list of disk names, are currently mounted. If they are, references to the matching disks will be passed to the next action. If no disks are matched, the action will stop the workflow.

Click here to download the installer for this action. Install the action and then proceed with step 2.

STEP 2: Add the Action to a Workflow

To have a workflow execute when a specific volume is mounted, add this action to the start of a workflow and enter the name of any disks you want to trigger the workflow to the Disk Names list. Follow the action with whatever other actions you want to use.

STEP 3: Save the Workflow as Folder Actions Plug-in

Select Save as Plug-in... from the File menu, and then select Folder Actions from the popup menu in the forthcoming sheet dialog.

If Folder Actions is not currently enabled, a checkbox titled Enable Folder Actions will be displayed in the sheet. Select this checkbox to turn on Folder Actions.

Next, select Other... from the Attached to Folder popup menu and a choose folder dialog will appear. With this dialog open, type a forward-slash character (/) and a path input sheet will drop down in the dialog window. Enter /Volumes in this text field and click the Go button to close the sheet. Then, click the Open button to close the choose folder dialog.

Click the Save button in the sheet dialog attached to the workflow window and the workflow will be saved as a workflow application attached to the Volumes folder.

Once the workflow is attached as a Folder Action, the workflow will execute when a volume is mounted and this action will check whether the mounted volume matches one in the list.

Disabling/Editing the Workflow

Should you want to temporarily disable the workflow, launch the Folder Actions Setup application located in the AppleScript folder in the Applications folder.

You can use this application to manage all of the Folder Actions on your computer.

If you wish to edit the workflow document, drag it onto the Automator icon to open it. The workflow will be located in your Library > Workflows > Applications > Folder Actions folder.