Re: AppleEvents, CGIs, Cocoa
Re: AppleEvents, CGIs, Cocoa
- Subject: Re: AppleEvents, CGIs, Cocoa
- From: Chris Hanson <email@hidden>
- Date: Sun, 27 Jan 2002 16:35:40 -0600
At 4:32 PM -0600 1/26/02, Chilton Webb wrote:
Now, this last thing I tried doesn't make much sense to me if there
really is some kind of protection against sending AppleEvents
between two apps that aren't of the same ilk. So now I'm really
stumped.
It's not so much that they're not of the same ilk but that they're in
different environments (running as different users etc.).
There's been some discussion on this on the Carbon-Development list.
Essentially, cross-"context" AppleEvents don't work out of the box.
For instance, you can't just send an AppleEvent from a user-level
application (in the loginwindow/window server context) to a daemon
launched at system startup. This is because the Process Manager is
currently bound to a loginwindow/window server context.
To make it work, you have to use Mach ports and Unix process IDs.
Steve Zellers of Apple talked about this on the mailing list and
posted a bit of sample code. Look for messages in the thread
"Scriptable daemon on OS X possible?" in December 2001, and in the
thread "Sending AppleEvents to a OS X Unix Tool Deamon" in January
2002.
You might be able to get away with just adding a Mach reply port
attribute to your events, using a Unix process ID instead of a
Process Manager signature to target them, and sending them with
kAEQueueReply rather than kAEWaitReply. At least this is what I
understand from Steve's posts; I haven't had occasion to try it yet.
-- Chris
--
Chris Hanson | Email: email@hidden
bDistributed.com, Inc. | Phone: +1-847-372-3955
Making Business Distributed | Fax: +1-847-589-3738
http://bdistributed.com/ | Personal Email: email@hidden