sending Apple events between users (Pause iTunes of different user, redux)
sending Apple events between users (Pause iTunes of different user, redux)
- Subject: sending Apple events between users (Pause iTunes of different user, redux)
- From: Matt Neuburg <email@hidden>
- Date: Sat, 29 Jan 2005 11:20:23 -0800
> From: Pat Stanford <email@hidden>
> Subject: Re: Pause iTunes of different user?
> Date: Tue, 24 Aug 2004 22:31:56 -0700
> To: email@hidden
>
> I knew there was a way to use Remote to another user, but didn't know
> what it was.
> This is what finally worked
>
> tell application "iTunes" on machine "eppc://user@localhost/"
> playpause
> end tell
Let's return to this issue. I quote from Apple's own documentation:
> Fast User Switching:
> AppleEvents have been enhanced to support Fast User Switching. Because of
> these changes it is now possible to send AppleEvents to applications running
> in any session, when the uid of the processes match. 'root', or uid 0
> processes are allowed to send to any process in any session. Non-root
> processes can only target applications that match their uid.
>
> To support remote AppleEvents in the multiple user scenarios, the
> typeApplicationURL definition has been enhanced with optional uid and pid
> parameters. Both uid and pid are optional. If not present, the active console
> user's applications will be targeted. As before, the username should be that
> of an admin user on the targeted machine.
>
> eppc://[user[:password]@host/Application Name[?[uid=#]&[pid=#]
>
> example:
> eppc://zellers:email@hidden/Finder?uid=501&pid=315
So in theory, by specifying the uid, I should be able to specify not just a
particular machine (which could be the machine I'm already on) but a
particular user from amongst those who are currently logged onto that
machine. Thus, I should be able to send Apple events between users on the
same machine, or to one particular user on a remote machine.
Now, this may or may not work when sending a raw Apple event, but I have
*never* gotten it to work from AppleScript (which is why I don't mention it
in my book). AppleScript always (a) munges the specifier rather badly, and
(b) targets one particular user. For example, if both user 501 and user 502
are logged in, and each has a window open in the Finder, then no matter what
I do, when I ask Finder for the name of window 1 using the above syntax, I
always get the name of the window open in one particular user - it is a
total crap shoot whether this will be the active console user or the hidden
user, but whichever it is, I cannot, on that occasion, find a way to get the
other user.
My questions are:
* Has *anyone* ever gotten this to work? I.e. can anyone tell me how to
target a particular logged-in user, *reliably*, on the same or a remote
machine?
* Is this a known bug?
* Does it work when sending raw Apple events, even if it does not work in
AppleScript?
* Is it going to work in Tiger???? Okay, don't answer that one; you'd be
violating NDA. :)
m.
--
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
AppleScript: the Definitive Guide! NOW SHIPPING...! (Finally.)
http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt
Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden