Mount a WebDAV drive on macOS using AppleScript
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"
try
mount volume "https://url-to-webdav.com/webdav/" 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 immediately 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.