Applescript: Automatically check and remount server volume stopped working Yesterday, I found a script that makes my Mac (MacBook Pro running El Capitan) automatically check for a volume on a server and remount it if the connection drops. I adapted it slightly to this, so my media server would remount when it drops (which is frequently):

on idle
    tell application "Finder"
        set isConnected to disk "Plex" exists
    end tell
    if isConnected = false then
        try
            mount volume "Plex" on server "smb://USER:PASSWORD@192.168.0.10:445"
        end try
    end if
    return 5
end idle


I saved the script as a Script Editor app using the "Stay open after run handler" option, so it runs in the background. 

Yesterday it worked fine. Today, when it attempts to remount the Plex volume I get a "There was a problem connecting to the server" error.

However, I can connect to the server using the 'Connect to Server' command by entering the same IP address, user ID and password.

I'm logging into the NAS with an admin account, so there shouldn't be any disk permission issues.

Is there something in the script I've scrambled, or is this an issue with the Mac or NAS? 

I'm completely new to scripting, so I may ask for clarifications on any answers.

I would like to include a link to the original script, but I can't recall where I found it.

Thanks.
I managed to solve this problem by 'borrowing' some code from a blog I found.

on idle
    set intnt to do shell script "ping -c 1 192.168.0.10; echo -n"
    set paras to number of paragraphs in intnt
    if paras &lt; 5 then
    else
        set serverIP to "smb://192.168.0.10/Plex"
        set UserAccount to "[USERNAME]"
        set ServerPassword to "[PASSWORD]"
        set serverVolume to UserAccount
        tell application "Finder"
            try
                if disk serverVolume exists then
                else
                    mount volume serverIP as user name UserAccount with password ServerPassword
                end if
            end try
        end tell
    end if
    return 5
end idle


I also found that if you add this code to the end of an app's info.plist file, its icon doesn't appear on the Dock. 

Just copy-and-paste these lines before the final /dict entry.

Downside is I have to use Activity Manager or Terminal to kill the app, but it makes for a tidier Dock.

&lt;key&gt;LSUIElement&lt;/key&gt;
&lt;true/&gt;