and I'm all out of bubble gum…

I just mentioned that my wife switches between two different iTunes libraries, including one that lives on a shared volume on our home server. There’s a great tip on Stack Overflow for writing a script to automate that swap between iTunes libraries (rather than having to hold down option while iTunes loads and then click around to find the library you want). But it seemed like it might be nice to document for posterity the full script that we’ve built, since it handles not just the library swapping, but also the mounting of the shared volume as well.

This script takes a little prep work, both generating the library location property and storing the authentication information in the user keychain. The Stack Overflow tip explains the former, and the latter is as easy as connecting to the server and remembering to check the “Save Authentication” checkbox during the authentication process.

-- set server connection information here
property serverProtocol : "afp://"
property serverName : "your-server-name-here.local"
property volumeName : "shared-volume-name-here"
-- define the desired library location and save the current library location ( explains exactly how to generate the appalling hexadecimal value for iTunesLibraryLocation below)
property iTunesLibraryLocation : ""
property libraryLocationPref : " 'alis:1:iTunes Library Location'"
-- try to mount share from server
	-- authentication credentials stored in keychain
	mount volume (serverProtocol & serverName & "/" & volumeName)
on error
	-- if we can't mount the share, we're done
	display dialog "The shared volume “" & volumeName & "” on the server “" & serverName & "” could not be mounted, so the remote iTunes Library cannot be used. Please check that you are on the same network as “Leviathan” and try again later." buttons ("Le sigh") default button 1 giving up after 15
end try
-- quit iTunes if it's running
tell application "System Events"
	if exists (application process "iTunes") then
		tell application "iTunes" to quit
	end if
end tell
-- set the desired library location
do shell script "defaults write " & libraryLocationPref & " " & quoted form of iTunesLibraryLocation
-- comment the above shell script and uncomment the one below to use the default iTunes Library
-- do shell script "defaults delete " & libraryLocationPref
-- (re)open iTunes
tell application "iTunes" to activate

March 18th, 2014

Posted In: How To

Tags: , ,

This post is part of a series that are components of my “Expert Plan” at my school, looking to create a shared resource for my colleagues as the school moves towards greater adoption of laptops and technology in our pedagogy.

This AppleScript application converts any word processing files that Pages can open into PDFs. This application will only work on Macs.


To use this application, drag a icon(s) of a file or group of files on to the icon for the application. When asked, pick which folder you would like to save the PDFs into. As the application runs, if Pages cannnot open a particular file, you will see a message warning you of this. When the application completes, it will display a list of all the files that could not be converted (or simply quit if all of the files were converted).


To install this application, click the link below to download it as a ZIP archive. Double-click the “Convert Word Processing Files to” icon to expand the ZIP archive and drag the application icon to where you want to use it.


November 22nd, 2009

Posted In: "Expert Plan", Educational Technology, How To, Useful Tools

Tags: , , , , , , , , ,