Mount a WebDAV drive on macOS using AppleScript

December 24th, 2017 | #applescript #macos

TIL how to mount a WebDAV drive using AppleScript.

AppleScript is primarily a scripting language developed by Apple to do inter-application communication using Apple events. AppleScript is built into all versions of macOS.

So I gave it a try, and mounted a WebDAV with AppleScript. This is what I came up with:

tell application "Finder"
        mount volume "" as user name "TonnyGaric" with password "VerYStr0ngP@$$wOrd"
    end try
end tell

You can try it yourself. Open Script Editor on your Mac and use the above code. Ofcourse, change the credentials to fit yours 🙂.

You can run it immediatly or export it as an Application. With Spotlight Search you are then able to quickly mount a WebDAV.

Is it safe to use? Hmm, I am not 100% sure. Your password is stored in the script itself, so be aware of that, please.

© 2018 Tonny Garić | With from Nijmegen, The Netherlands