AppleScript vs. Fast User Switching!!

Fast User Switching – 1
AppleScript – 0

The instance of iTunes that receives Apple Events is the one running under the current user. I’ve noticed this behavior with Remote Apple Events apps that want to control iTunes. What this means is that if you’re blasting iTunes and another user switches to their account, your iTunes stops responding to AppleScript commands.

Now, hold on a minute! iTunes does respond to AppleScript from another app running under the same user, active login be damned. For instance, I have an AppleScript Studio app I made to update a “last song played” PHP script. The result of which can no longer be seen on my homepage (StrawHousePig – Home) and in the form of an image I use for profile or sig pics at various forums that allow it.

The AS Studio app polls iTunes and sends current track info to the PHP script. I always meant to finish and release it, but once I got it working for us I said, “screw it, good enough”. The important thing here is that it updates without my user being active.

So while it may be kewl to hi-jack your wife’s or other relatives iTunes, it’s only funny till they hear you laughing about it. Actually controlling your own iTunes would be much better. Though the real value of doing so is made moot unless you’re streaming iTunes through an AirPort Express or other means as that’s the only way to hear your iTunes while your user isn’t the active one.

I’ll have to look into running an AS app that can pass ARGVs from osascript to iTunes as commands. But, osascript may break that.

The point of all this is that with this technique it should be possible to run Apache as www instead of a real user, making iTunesDSr much more secure to use.

Leave a Reply

Your email address will not be published. Required fields are marked *