Example Workflow: Easy-Share .Mac Photos
Here's a common scenario: you post pictures of the baby or your latest vacation to your .Mac website and one of your friends or relatives wants to add them to their iPhoto library but doesn't know how.
No problem. Automator can make an automated downloader application that makes downloading and adding your images to their iPhoto library, a simple one-step operation. Just send them the applet in an email and it will do all the work!
And creating this portable powertool is a breeze -- here's how...
Step 01: Inform the User
It's important to make the process of sharing your images with others an easy experience. Don't make them figure out what to do or what is about to happen. Tell them, and give them the opportunity to decide whether to download the images or not.
In a new Automator window, select the Automator application library in the Library List on the left side of the window, and then drag the "Ask for Confirmation" action from the Action List to the workflow area on the right side of the window. Its Action View will appear when you release the mouse.
When the workflow is executed, this action will display a dialog containing two buttons to the user. One button will stop the workflow, the other will continue. This allows the user to decide whether they want to run the workflow or not.
Fill in the action parameters as shown above, and test the action by clicking the "Run" button at the top right of the Automator window. The confirmation dialog will be displayed with the "Continue" button being the default button.
Step 02: Identify the Webpages
The next step is to tell the workflow what webpages contain the images to be downloaded. Click on the Safari application icon in the Library list and select and add the "Get Specified URLs" action to the end of the workflow.
By default, this action comes with the link to the Apple website as the only item in the URL list. Select this link and click the button at the lower left of the Action View that contains the minus (-) character. The selected link will be removed from the list.
Next, click the button that contains the plus character (+) to add a new entry to the URL list. Double-click the left side of the new list item to activate editing of the site name and enter: Tom and Trina. Then, type the Tab key to select the right side of the list entry and enter: http://homepage.mac.com/smith.family/newwedding/index.html
NOTE: An alternative method of adding URLs to the URL list is to open the desired webpage in Safari and click the "Current Safari Webpage" button in the Action View to automatically add the URL of the frontmost Safari browser window to the action's URL list.
Before proceeding to the next step, make some space for more actions in the workflow area of the Automator window by collapsing the existing Action Views. Click the disclosure triangles next to each action's title to collapse its Action View.
Step 03: Locate the Images
Now that the workflow knows what webpage to use, the next step is to tell the workflow what to do with the page you specified, namely locate the images to be downloaded. From the Action List, add the "Get Image URLs from Webpage" action to the end of the workflow.
The Action View for this action contains only one parameter, whether to locate the images on the indicated webpage, or to locate the images linked from images on the indicated page.
On most .Mac websites, larger images are represented by smaller images or "thumbnails" that act as clickable buttons to reveal their corresponding larger images. In this example scenario, choose the "linked from these webpages" option from the popup menu in the Action View.
When this workflow is executed, this action will locate all the linked images and pass their URLs to the next action in the workflow.
Step 04: Download the Images
Once the workflow has located the images linked from the indicated webpage, it will need to download them to your computer. From the Action List add the "Download URLs" to the end of the workflow.
Like the previous action, this action also has a single parameter, namely the folder on your hard drive in which to place the downloaded images. Select the Pictures folder from the popup menu in the Action View.
Step 05: Import the Images
The final step in this workflow is to add the downloaded images into the users iPhoto library. Select the iPhoto application library from the Library List in the Automator window and then add the "Import Photos into iPhoto" action to the end of the workflow. The iPhoto application will launch if it is not already open.
The first parameter in the Action View indicates whether you want to import the images into an existing album or library, or to create a new album for the images. Select the "New Album" option and enter the name of the new album in the text input field. For this example, enter "Tom & Trina's Wedding" as shown above.
THe second parameter in the Action View is for indicating whether or not to belete the original images after importing them into iPhoto. Since iPhoto automatically makes a copy of the images it imports, there is no use to keep the downloaded images after they've been imported into iPhoto. Select the "Delete the Source Images" checkbox to have the workflow move the downloaded images to the Trash after import.
Step 06: Save the Workflow
The workflow is complete. Now save it to the Desktop by choosing "Save As..." from Automator's File menu.
In the Save dialog, enter the name for the workflow and from the "File Format" popup menu at the bottom of the dialog, choose "Application" to save the workflow as a self-running application.
Automator workflows saved as applications have an icon of Otto standing on a square as shown above.
Step 07: Send the Downloader Applet
You can now send the workflow application to family or friends as an attachment to an email message by simply dragging the workflow applet to the Mail icon in the Dock. A new email message containing the applet will appear in Mail.
When the recipient runs the applet on their computer, the confirmation dialog you set up at the start of the workflow will appear. If they choose to continue the workflow, a spinning progress cursor will appear in the menu bar at the top right of their screen.
A status message next to the cursor will identify which action is being perfomed. The small red button is for stopping the workflow if desired.
Once the images have been downloaded, the workflow will launch iPhoto and import the images into a new ablum.
Congratulations, you've now created an image downloader application! You can easily customize the workflow to work with your .Mac website by changing the parameters in the various actions. To edit the application, drag its icon onto the Automator icon in the Applications folder and its workflow will open in Automator.