I am editing an Automator workflow that currently takes several stored spreadsheets and emails them to different individuals. The spreadsheets are stored on a Windows server and are created by a separate process not germane to this discussion. But once they're created, I want the user to be able to click on this action and have the mail messages (usually 8 of them) pop up to be sent.

All this works fine, as long as the Mac's connection to the server exists. If the server connection isn't present, things fail silently, because the files aren't there.

I've looked through all the possible steps you can add in Utilities, Other, and Finder (and all the rest) and I can't find any way for it to do something like e.g. 'Skip this step if the variable ServerConnected is not null'.

I can automagically connect to the server with an Automator action, but if it's already connected, I get another connection, which causes me trouble later on...unmounting unmounts the first one and the server stops showing up, but then the path in /Volumes is still there...it's a road I don't want to go down.

So, is there any way to use variables to check if a condition is true or false and skip steps based on that? Or any other way to accomplish the task? I don't use Automator too much, I'm more comfortable with scripting the old fashioned way so even cracking open the .workflow file and editing parameters by hand is an option, presuming you can do that. I'm editing this particular workflow because it was developed by someone else, and it really does do a good job in general, except for the server connection glitch.


You could split it into 3 automator apps and branch with a shell script. Run the normal workflow up to the connection check, and then use the automator action Do Shell Script.

That script could be something like:

#! /bin/bash

        <your command to test connection>
        open /pathto/automator_connected.app
        open /pathto/automator_not_connected.app

automator_connected.app would contain the remainder of you automator workflow

automator_not_connected.app would contain the actions to take if the server connection fails

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.