Re: sending Apple events between users (Pause iTunes of different user, redux)
Re: sending Apple events between users (Pause iTunes of different user, redux)
- Subject: Re: sending Apple events between users (Pause iTunes of different user, redux)
- From: deivy petrescu <email@hidden>
- Date: Sun, 30 Jan 2005 09:50:37 -0500
On Jan 29, 2005, at 14:20, Matt Neuburg wrote:
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.
<snip>..............................................
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.
First, many thanks, I've tried something like that before and it did
not work. At least I found a way to target an app running by another
user.
I used a different "URL" if you will. I (admin) targeted Safari and
used the following:
tell app "Safari" of machine "eppc://user2:PassWdofUser2/Safari"
Initially it refused to grant me access, but then it prompted me to
enter a password in a dialog where the userid was user2 (not me, I am
admin). If I entered user2's password it would not login, however,
entering my (admin's that is) password it would run the script
correctly.
Notice that the dialog had user2's name and it only accepted admin's
password.
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.
I can corroborate that. After running the script, I could change the
target to user3 but the script would not target user3's Safari, only
user2. It would not prompt me anymore for any password.
Note that I did the above both as admin and as root. That is, I run AS
as root and as an admin and the same thing happened. There was actually
no difference in the behaviour of the script between admin and root.
Different scripts target different users, but once the script compiled
and run, I had to stick with the same 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/
I will try to tell you my thoughts on this.
when you target a remote machine (another machine altogether) and you
put the password and userid in the script, to compile the code, the
script will try to open the connection in that machine with that
userid, once you are in, you are in! You would not be able to target
any other machine since you have the machine name and userid processed
during compilation.
I believe the same thing happens with the above script, in spite the
fact that, when you change the script, it will not let go of the
machine and the user that you target.
It does seems like a bug, but as we all know, it might be a feature.
That, I'll leave unanswered...
deivy
--------------------------------------------
Agora quem da bola é o Santos,
Salve o novo campeão!
_______________________________________________
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