One of my standard lunchtime reading web sites started me off on this; The Unofficial Apple Weblog got me reading an article on PC Magazine’s site about Argh! moments. That sort of moment when you try to do something really simple on OS X but find it isn’t. In this case, Robyn Peterson’s struggle to mount a network volume on login struck a chord. I’d gone down a similar route and come up with an alias to a network volume in my login items, a solution which seems to be well documented after a quick Google search.
But this wasn’t quite enough for me; my main Mac is an iBook and that means I access network volumes at home and at work so automatic reconnection to a non existant volume at home when I connect my iBook to my employer’s corporate LAN wasn’t really a solution. But from Robyn’s article I decided to take the plunge and write my first AppleScript.
Maybe write is too strong a word; I found the script I needed almost verbatim on the MacFixIt forums. All I needed to do was modify it to my own ends.
Firstly I needed Apple’s Script Editor, which lives in /Applications/AppleScript; then I was able to enter the following script.
tell application "Finder" open location "smb://user:password@server/share" end tell
A few words of explanation. Firstly the names have been changed to protect the innocent so I’m not using a real user name, server name or share name and I’m most definately not using a real password. Secondly the network volume I’m connecting to is on a machine running Fedora Core and which is made available to the network using Samba, hence the smb: part of the URI.
I then saved the script somewhere meaningful; I keep a directory called Scripts which unsurprisingly contains scripts so that seemed as good a place as any. I also made sure that when saving the script I saved it as an application and not a script to prevent me being prompted whether I wanted the script to run each time I ran it, as well as ensuring that the Run Only, Startup Screen and Stay Open check boxes were deselected.
Then it was a simple matter to run the script either from a Finder window or via Spotlight and my network volume mounted and was available.
Another Piece Of Bloggage By Gary
Self professed "geek with a life", geo-blogger, geo-talker and geo-tweeter, Gary works in London and Berlin as Director of the Places Registry for Nokia; he's a co-founder of WhereCamp EU, the chair of w3gconf and sits on the W3C POI Working Group and the UK Location User Group. A contributor to the Mapstraction mapping API, Gary speaks and presents at a wide range of conferences and events including Where 2.0, State of the Map, AGI GeoCommunity, Geo-Loco, Social-Loco, GeoMob, the BCS GeoSpatial SG and LocBiz. Writing as regularly as possible on location, place, maps and other facets of geography, Gary blogs at www.vicchi.org and tweets as @vicchi.
Mail | Web | Twitter | Facebook | LinkedIn | Google+ | More Posts (271)Other bloggage that may or may not be geo-related to this one:
- Running Shell Scripts With AppleScript
While I was playing with AppleScript earlier this week I wanted to run a shell script I’d written from within Finder rather than from a shell prompt in Terminal.app. On...
- Windows RDP and the Network Swiss Army Knife
Consider the following scenario for a moment; you have a home network, hooked up to a broadband connection. You’ve done your homework and have a firewall with little or no...
