Difficulty sending synthetic events to loginwindow.app
Difficulty sending synthetic events to loginwindow.app
- Subject: Difficulty sending synthetic events to loginwindow.app
- From: "Tom Dilligan" <email@hidden>
- Date: Sun, 13 Apr 2008 13:07:14 -0700
Greetings:
I'm not quite sure if this is the best forum for my question
(it's either here or the cdsa list, since I think there are
two potential solutions to my problem).
The basic problem:
I'm trying to write a mechanism by which a username and password
can be (programatically) entered on the login screen to log in a
user. Auto-login is not an acceptable solution because you can
still log out of even a limited account, and then the login
screen comes up (since there are 'normal' accounts on this machine
as well).
Using the PreLoginAgents sample (as mentioned in technical note
TN2083) I modified it so that by pressing the UI button it would
determine the PSN of the login window and then construct / send
keystroke events via the CGEventPostToPSN function. If I run the
agent in a non-login context and point the PSN to some other
application (like terminal), everything works fine, but when
running in the pre-login context I get the following messages in
the debug syslog (which seem to be generated by the
CGEventPostToPSN function).
Apr 13 12:39:59 leipzig htla[429]: 3891612: (connectAndCheck)
Untrusted apps are not allowed to connect to or launch Window Server
before login.
Apr 13 12:39:59 leipzig htla[429]: Window Server is not available.
The last message is repeated for each event.
Now my pre-login agent seems to be connecting OK since it will
display the UI elements properly, but it can't actually send the
synthesized events.
Another possible solution would to be use the fast user switch
program (/System/Library/CoreServices/Menu Extras/User.menu/Contents/
Resources/CGSession)
since the user that is getting switched to is always a limited
account and as such does not need a password. But this seems to
suffer from the same issue in that it can't switch away from a
login screen (even when exec'd from the pre-login
agent (which I would presumed would cause it to inherit the
privileges of the pre-login agent)).
Any help would be appreciated on this. Thanks.
#! /bin/tom
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden