Reader Collin Merrill would like to automate a common, but potentially risky, task on his Mac. He writes:
I was just wondering if you had an Automator workflow to automatically empty the trash. I'm fairly new to a Mac, and have almost no experience with Automator.
As you've likely noticed, while there is an Automator action for moving items to the trash (found in the Files & Folders area), there's no specific action for then emptying the trash. And that's a wise move on Apple's part as having such an action might lead to "Oh wait, I didn't mean to delete that!" situations.
But Automator's savvy designers have provided a workaround for things like this. And that workaround is AppleScript. While you may not be able to access an Apple-created Empty Trash action, you can build an AppleScript that accomplishes this task that's included as part of your workflow. I'll demonstrate by creating a workflow that only empties the trash when executed.
Launch Automator, choose the kind of workflow you want to create (in this case let's choose an Application workflow), and in the resulting window select the Utilities entry in Automator's first column and drag the Run AppleScript action to the workflow area to the right.
Highlight the text that reads (* You script goes here *) and enter:
tell application "Finder" empty the trash end tell
The entire content of that Run AppleScript action should now look like this.
Save your workflow to the desktop. Be sure there's something in the trash (and that you really want to empty the trash) and then double-click on your workflow to execute it. The trash will empty.
And that's the idea. When you can't find a way to accomplish one task or another with Automator's default tools, it's possible that you can do the job with AppleScript.