{"id":275,"date":"2006-08-15T23:23:34","date_gmt":"2006-08-16T06:23:34","guid":{"rendered":"http:\/\/strawhousepig.net\/wp\/?p=275"},"modified":"2006-08-15T23:23:34","modified_gmt":"2006-08-16T06:23:34","slug":"applescript-vs-fast-user-switching","status":"publish","type":"post","link":"https:\/\/strawhousepig.net\/wordpress\/2006\/08\/15\/applescript-vs-fast-user-switching\/","title":{"rendered":"AppleScript vs. Fast User Switching!!"},"content":{"rendered":"<p>Fast User Switching &#8211; 1<br \/>\nAppleScript &#8211; 0<br \/>\n<!--more--><br \/>\nThe instance of iTunes that receives Apple Events is the one running under the current user. I&#8217;ve noticed this behavior with Remote Apple Events apps that want to control iTunes. What this means is that if you&#8217;re blasting iTunes and another user switches to their account, your iTunes stops responding to AppleScript commands.<\/p>\n<p>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 &#8220;last song played&#8221; PHP script. The result of which can <ins datetime=\"2010-12-24T15:48:34+00:00\">no longer<\/ins> be seen on my homepage (<a href=\"http:\/\/strawhousepig.net\/\">StrawHousePig &#8211; Home<\/a>) and in the form of an image I use for profile or sig pics at various forums that allow it.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"oniTunes\" src=\"http:\/\/strawhousepig.net\/onitunes\/onitunes.png\" alt=\"\" width=\"115\" height=\"33\" \/><\/p>\n<p>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, &#8220;screw it, good enough&#8221;. The important thing here is that <strong>it updates without my user being active<\/strong>.<\/p>\n<p>So while it may be kewl to hi-jack your wife&#8217;s or other relatives iTunes, it&#8217;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&#8217;re streaming iTunes through an AirPort Express or other means as that&#8217;s the only way to hear your iTunes while your user isn&#8217;t the active one.<\/p>\n<p>I&#8217;ll have to look into running an AS app that can pass ARGVs from osascript to iTunes as commands. But, osascript may break that.<\/p>\n<p>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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fast User Switching &#8211; 1 AppleScript &#8211; 0<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,7],"tags":[10],"class_list":["post-275","post","type-post","status-publish","format-standard","hentry","category-code","category-web","tag-applescript-2"],"_links":{"self":[{"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/posts\/275","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/comments?post=275"}],"version-history":[{"count":0,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/posts\/275\/revisions"}],"wp:attachment":[{"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/media?parent=275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/categories?post=275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/tags?post=275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}