In my last post, I shared some useful tips for troubleshooting Automator workflow problems. I didn't cover everything, though. There are lots of other ways you can troubleshoot your workflow. Here are some more tips to help.
1. Use Get Selected Finder Items Wisely
Automator workflows are frequently created to process files and folders. When you save a workflow as an application, you can drag files and folders onto it and they're passed right into the workflow for processing. Other types of workflows behave similarly. Save a Folder Action workflow, for example, and every time new items are added to the folder, they're automatically passed to the workflow for processing.
At the top of a workflow, Automator tells you if it receives files and folders as input.
From time to time, however, you may notice that your workflow has processed your files twice, or that it's encountered some kind of obscure error. Often, this is due to the presence of a Get Selected Finder Items action at the beginning of the workflow. As enticing as its name sounds, the Get Selected Finder Items action isn't always needed to process files and folders. Remember, depending on the type of workflow you built, those items may be passed automatically to your workflow. In these cases, the inclusion of the Get Selected Finder Items action causes the dropped items to be appended to themselves. This can result in the items being processed twice or an error. So, what's the solution? Just try removing the Get Selected Finder Items action from the beginning of your workflow. Many times, that one simple change fixes the problem.
Don't insert the Get Selected Finder Items action at the start of a workflow if your workflow already receives Finder items as input.
2. Finding Missing Output Files
Imagine this. You run an Automator workflow that takes a PDF and outputs its pages as images. The only problem is that the images never seem to show up. Sound familiar? If you've ever been unable to find files output by a workflow, it may not necessarily mean that your workflow failed. Those files may actually be buried somewhere on your system. This is because some Automator actions generate their output files in hidden temporary folders. The Render PDF Pages as Images action is one example. It extracts the pages of a PDF as image files, gives them unique names, and saves them into a hidden temp folder.
Render PDF Pages as Images sneakily outputs files to a hidden folder. Note that it doesn't have an option to select an output folder.
To determine whether this has happened, run your workflow in Automator. Then, open the action's Results area. If there are files or folders listed, you should be able to figure out where they're located by viewing them in list view.
An action's Results area tells you if an action really produced a result.
To output the files or folders to the desired location, just insert a Move Finder Items action into your workflow. This should move the items from their secret location to the Desktop or wherever else you choose.
Use the Move Finder Items action to move hidden output files someplace more useful.
3. Improving Recorded Task Playback
A great feature of Automator is its ability to record things you do manually, so you can play them back later as part of your workflow. A not so great feature of Automator is its knack for being unable to play back what it records. There are a number of reasons this can happen, and some options for fixing things.
You may have made a mistake while recording. Remember, Automator is watching. So, it picks up your mistakes too. If this happens, try selecting the extra steps in the Watch Me Do action Automator adds to the workflow. Then, press the Delete key to remove them.
You can remove recorded steps by selecting and deleting them.
You may have moved too fast, and Automator couldn't keep up. It may have missed some of what you did. You can try to resolve the problem by recording the steps again. This time, take your sweet time.
Automator may be unable to repeat what you did manually. Unfortunately, Automator can't access everything in OS X. It can access a lot, but not everything. If this happened, consider trying a third-party macro utility, such as iKey. It may have greater reach than Automator.
4. Locating Missing Actions
If you've ever launched Automator but have been unable to locate an action that you used in the past, it may not mean that action is entirely gone from your Mac. Automator may just be unable to load it for some reason. For example, maybe the app the action works with isn't installed anymore. You can see what Automator is unable to load by checking the Console app (in /Applications/Utilities). Just open it up, launch Automator, and see what shows up in the Console.
The Console app tells you what actions Automator can't load. Here, the Entourage actions weren't loaded because I don't have Entourage installed anymore. I now have Outlook installed.
5. Service Workflows Not Triggering?
Have you created service workflows, but when you trigger them, they don't seem to run? Give them some time. For whatever reason, they may take some time to get going. After one has run, however, subsequent service workflows should run a bit faster.
You may have also noticed that you can assign keyboard shortcuts to Service workflows. If you haven't noticed this, you can do it in System Preferences > Keyboard > Keyboard Shortcuts.
Assigning a keyboard shortcut to a Service workflow
Once you've assigned a keyboard shortcut, you may have found that the workflow doesn't run when you press the keyboard shortcut. One possible fix is to manually choose the workflow from the application's Services menu. Then, once it's been triggered for the first time, the keyboard shortcut often starts working again.
Hopefully, these tips and my prior tips have put you on the path to more stable and reliable workflows. Good luck and Happy Scripting!