Ok, I solved my own problem. Its a bad idea to name the script iTunes and save it as an application, because then it doesn't know which iTunes to activate. Oops!
Anyways, here is the full script I'm using now, it works like a charm! It calls extra suites which can be found here:
Kanzu | Software.
[codex]tell application "Extra Suites" to set kd to ES keys down
if kd contains "Option" then
display dialog "Please Choose a Library" buttons {"Local", "External"}
if button returned of result = "Local" then
tell application "Finder"
duplicate file "Ben:Users:ben:Library:Preferences:iTunes Local:com.apple.iTunes.plist" to folder "Ben:Users:ben:Library:Preferences" with replacing
end tell
tell application "iTunes" to activate
else
tell application "Finder"
if (exists "Ben:Volumes:Ben's External Drive:iTunes Complete:iTunes Library") then
duplicate file "Ben:Users:ben:Library:Preferences:iTunes Complete:com.apple.iTunes.plist" to folder "Ben:Users:ben:Library:Preferences" with replacing
tell application "iTunes" to activate
else
display dialog "External hard drive not connected" buttons {"OK"} default button "OK"
end if
end tell
end if
else
tell application "Finder"
if (exists "Ben:Volumes:Ben's External Drive:iTunes Complete:iTunes Library") then
duplicate file "Ben:Users:ben:Library:Preferences:iTunes Complete:com.apple.iTunes.plist" to folder "Ben:Users:ben:Library:Preferences" with replacing
else
duplicate file "Ben:Users:ben:Library:Preferences:iTunes Local:com.apple.iTunes.plist" to folder "Ben:Users:ben:Library:Preferences" with replacing
end if
stop
end tell
tell application "iTunes" to activate
end if[/codex]