I've been slowly getting into Applescript lately since I've moved back to Mac for the majority of my work. I recently went through the process of moving the iTunes library file from my PC desktop to my Mac. After all, you can't have a Mac and use iTunes on your PC!

Anyway, I keep all the actual media files on a network share to ease with backup chores and to allow accessing the files with other players etc...  This hasn't posed any problems in the past, but now that I use a Macbook Pro to interact with iTunes, the network share is not always present.  I wrote a small Applescript to check for the existence of the share and then mount it if it's not there before opening iTunes. Since it seems that catching an error from a failed SMB mounting operation is difficult to do in Applescript, I attempt to grab the computer's IP address and only attempt the mount if it contains a value indicating I'm connected to my home network.

Yes, there is probably a better way to do this, and if anyone knows of one, feel free to drop me a line.

The code:

--Avoid undefined errors probably a better way set check_network to "" set check_wireless to "" try set check_network to do shell script ¬ "ipconfig getifaddr en0" on error set check_wireless to do shell script ¬ "ipconfig getifaddr en1" end try if check_network contains "192.168" or ¬ check_wireless contains "192.168" then tell application "Finder" if not (exists disk "music") then open location ¬ "smb://user:pass@server/music" end if repeat until (list disks) contains "music" end repeat launch application "iTunes" tell application "iTunes" activate end tell end tell end if

I've always been a fan of Apple products. I love the design, the technology, the packaging. I was one of those "Mac guys", taking every opportunity to preach how Macs were better than PCs etc... However, once more and more of my paid consulting work was based on Microsoft technology, I had to stop replacing my aging machines with new Macs. The last new Mac I purchased was the blue and white "Yosemite" G3. Yea, a while ago.

These days, just about all my current development work is done in PHP. I also gave up on trying to maintain a desktop system in addition to my laptop, as it became a royal pain the ass to keep things synchronized between my machines. For at least the the last two years I've been using my XPS laptop as my primary, non-server, machine...and it's time for a new one. I've been obsessing over the MacBook Pro 17" for the last few months and now there is one in transit to my home as we speak. I've not used OS X to any extent (the G3 shipped with OS 9) so it will be an interesting journey getting used to the new os. I'm very familiar with *nix systems, so it shouldn't be too much of an issue.

My biggest concern, and to some extent, what I'm looking forward to the most, is finding that perfect mix of daily tools and utilities.  I plan on using VMWare Fusion to run the occasional Windows application, or for testing things in IE.  Although, I'll probably install Windows on a Boot Camp partition, just in case.

I'll continue to post my observations as I get more into the process...stay tuned!