A “Do Nothing” Action for Automator, and Why You Need It

EDIT: As I suspected would happen, somebody (Dan Wineman) informed me of the one option I was missing that made this entire exercise unnecessary:

I’ll still argue, though, that this is poor interface design. All of the other items on that context menu are things to be done to the action at design time. Ignoring input is something for the action to do at execution time, making it a better fit in the Options section.

END EDIT

Automator can really be useful, but this week I ran into what is either a design flaw or an omission in the implementation of variables.

Take setting a variable:

The Set Value of Variable Action

The problem is that little downward point. That means that this action has output—specifically, it outputs whatever was input.

While this is not necessarily the wrong way to handle it, it’s not the way I would have done it.

If Set Value of Variable didn’t have output, you could just use a Get Value of Variable action to retrieve it. As it works now, though, there’s no predefined way for the following action to ignore the output.

To illustrate, consider this workflow:

It simply prompts the user for two variables, with default values of “One” and “Two”, then retrieves the first variable and places it in a new text document.

Running it, you get:

So far, so good

Hitting return, you then get:

Uh-oh!

The default value gets clobbered by the output from the previous Set Value of Variable action.

Replacing the “One” with “Two”, then hitting return, you get:

Not quite what we wanted, or expected. It appears that Get Value of Variable is either accepting input, which makes no sense and isn’t mentioned in its description, or Automator is making a collection out of the output of two sequential actions when the second doesn’t require input.

The solution would be some sort of null statement—a Do Nothing action, but there isn’t one!

So let’s make one:

Bye-bye output we didn't want!

If you’re terminal-phobic, don’t worry. Let’s just say action takes its input and sends it to the cornfield.

Inserting this action into two spots in the example workflow will make everything run as expected:

Yay!

When I’ve got a little more time, I’ll package up a Do Nothing action in Xcode and post a link to it here for those that would find it more aesthetically pleasing than this quick fix.

Notes

  1. beenreemarria reblogged this from codelahoma
  2. tastslowearri reblogged this from codelahoma
  3. codelahoma posted this