0
votes

I have iTunes on set up of my iMac to share an iTunes library between two different users. This means that if one person forgets to quit iTunes, the other user has to log in to the other account and quit itunes before they can use it on their own account.

So is there a way to use applescript to quit an application for all users? I know it's easy to tell it to quit an application for the current user, but haven't been able to figure out if it is possible to have it quit another user's instance of that application.

3

3 Answers

0
votes

You can simply use an shell (terminal) command.

You can either enter killall iTunes in the terminal, or do shell command "killall iTunes" in Applescript.

It doesn't sound very healthy, but it's actually just a 'Forced Quit'.

0
votes

I'm not on my Mac at the moment, so cannot look into this further.

But it may work better if you turn fast user switching off. Doing so will not stop two or more users logging in but will hide the GUI for it.

The create a Automator service or app or a Applecript/app or script. To run this AppleScript code.

tell application "iTunes" to quit
do shell script "'/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession' -suspend"

This code should quit iTunes and than show the login screen. Where the next user can login. The other user will not be logged out.

0
votes

Since I can't respond yet, I'll just do it this way:

Markhunte:

Make that

tell application "iTunes" to quit
do shell script "'/System/Library/CoreServices/Menu\\ Extras/User.menu/Contents/Resources/CGSession' -suspend"