0

I’m trying to write an Automator Workflow to reconnect macOS to some not-very-remote SMB shares (on a server beside the Mac). For some reason adding them to my login items doesn’t always work.

Using an old answer at:

How can I get Automator to mount a network volume?

I have two actions:

  • Get Specified Servers, where I list the shares
  • Connect to Servers

The problem is that if the share is already mounted, I get a “Connect to Servers failed” error, and the script exits without trying the next one.

Is there a way to test for the server first, or at least to ignore the error?

1 Answer 1

0

Seems like it would be easier to just Applescript it. Here is the one I use. Obviously server and share names would have to be changed, as well as the protocol if the server doesn’t support AFP.

tell application "Finder"
    try
        mount volume "afp://DiskStation.local/Archive"
        mount volume "afp://DiskStation.local/Documents"
        mount volume "afp://DiskStation.local/Media"
        mount volume "afp://DiskStation.local/Pictures"
    on error number n
        display alert ("Error " & n & " on network share mount")
    end try
end tell

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .