Change Aperture Libraries with Applescript

Allan Marcus has contributed this handy Applescript to the Apple discussion boards. Compile and save it as an application using Script Studio, then drop onto the icon the Aperture library you want Aperture to open. If you double-click on the icon, Aperture will open.

on open (theFiles)
set lib to quoted form of POSIX path of theFiles
if isAppRunning("Aperture") then
tell application "Aperture" to quit
end if
repeat while isAppRunning("Aperture")
delay 1
end repeat
try
do shell script "defaults write ~/Library/Preferences/com.apple.Aperture LibraryPath " & lib
end try
delay 1
tell application "Aperture" to activate

end open

on run
tell application "Aperture" to activate
end run

on isAppRunning(pAppName)
tell application "Finder"
set appIsRunning to process pAppName exists
return appIsRunning
end tell
end isAppRunning
The Bagelturf site welcomes Donations of any size