HowTo mount a NT Share when an app launches?

I want my kids to have acces to an iTunes Library on an NT Share but I only want it to be mounted when itunes is launched and then dismount when itunes is quit or not running. I want this to be idiot proof, in other-words, I do NOT want to Make them click on an applescript application that does the work. If another application invokes itunes it should mount the volume as well, if itunes crashes then the volume should be dismounted. I want it all under the surface. Likewise this activity needs to stay out of the dock as much as possible. I assume that with all the automation that OS X is capable of this is doable but HOW?



It’s not as simple as simple as it should be.

If iTunes were attachable, you’d be able to run scripts when the app launches and when it quits, which makes this easy, but that’s not an option.

One typical way of handling this is to run the script first, and have it load iTunes, but that won’t handle your requirement for working no matter how iTunes is launched.

That leaves your final option, which is a script that runs in the background periodically checking to see if iTunes is running or not and taking appropriate action.

The following script should get you started. Save it as a ‘stay-open’ script. It will check every 10 seconds and take appropriate action:

[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]