My wife and I are set up on a single laptop and I have our iTunes libraries stored on an external HD. I'm writing an applescript to auto eject that drive when we want to take the laptop elsewhere (we normally use iPads around the house), but I'm having trouble getting the script set up to also quit iTunes for both of our accounts when run.
Here's the basic script right now which is obviously missing the magic to quit iTunes for all logged in users:
tell the application "iTunes" to quit
tell the application "Finder"
if disk Media exists then
eject disk Media
end if
end tell
Any suggestions?
Best Answer
The problem is that your Applescript runs in the context of the current user and can't access the iTunes running in other accounts. One way to close/terminate all running iTunes processes would be (in Terminal)
but this may leave the iTunes meta data in an inconsistant state (which means longer startup time the next time you start iTunes and potential data loss).