Skip Navigation

Ramblings from the team at zinc Roe

Metal Fish Eggs

ConnectToSharedDrive.app

Here in the office, we use a network drive (called Betsy) to store all of our files. Because I’m too lazy to manually connect to Betsy drive each time I turn on my computer, I use a little AppleScript to do it for me (ip address changed to protect the innocent):

tell application "Finder"
	if not (exists disk "betsy") then
		mount volume "afp://luke@127.0.0.1/betsy"
	end if
end tell

Here’s how to do it…

Paste the above AppleScript code into the Script Editor (/Applications/AppleScript/Script Editor.app), then chose File > Save As… and save it as ConnectToBetsy.app. Make sure to choose Application instead of Script as the file format.

Screenshot of Save As... settings in Script Editor.

Then, add ConnectToBetsy.app to your login items. Open System Preferences > Accounts, select your account and choose the Login Items tab. Click the + icon at the bottom to add a new login item, and browse to ConnectToBetsy.app.

Screenshot of Login Items after adding ConnectToBetsy.app

That’s it, you’re done! The next time you start up your computer, it will automatically connect to the network drive (It’ll ask you for your password the first time. Just make sure to check the Remember my password checkbox so it won’t ask you every time). If the network drive ever gets disconnected, you can just double click ConnectToBetsy.app and presto, you’re reconnected.

Enjoy!

2 comments on ConnectToSharedDrive.app
  1. Jason Says:

    So… um… nifty script. But you can also just drag the shared drive directly into the list of Login Items? Presto magic.

  2. Luke Says:

    Haha, that sure shows me up on the Simple-O-Meter…

Your Comment…

You can use these tags: <a> <blockquote> <strong> <em> <strike> <code> <pre> Use <pre lang="LANGUAGE"> for syntax highlighted code blocks.