Re: Sending Apple events to yourself
Re: Sending Apple events to yourself
- Subject: Re: Sending Apple events to yourself
- From: Dustin Voss <email@hidden>
- Date: Thu, 13 Jul 2006 11:46:11 -0700
On 12 Jul 2006, at 8:21 PM, Gregory Weston wrote:
David Alter wrote:
I'm working on a plugin to an application. I can sent Apple Events to
the application to do things and that works fine. Now I have
situation where I need to get the reply. This always results in an
event timeout.
If so what do I need to do? I found a tech note on sending
events to your self but it was pre OSX and I question if it is still
valid.
Um. That's probably unnecessarily complicating things. Here are the
most likely failure points.
1: You should provide an idle handler.
pascal Boolean MyIdleFunction(EventRecord* event, long* sleepTime,
RgnHandle* mouseRgn)
{
#pragma unused(event)
*sleepTime = 30;
*mouseRgn = nil;
return false;
}
2: The most efficient addressing method is a ProcessSerialNumber
set up like this.
thePSN.highLongOfPSN = 0;
thePSN.lowLongOfPSN = kCurrentProcess;
3: And there's the actual call once you've constructer the request.
theResult = AESend(&theRequest, &theReply, kAEWaitReply,
kAENormalPriority, kNoTimeOut, MyIdleFunction,
NULL);
AESendMessage is probably a better choice than AESend. It does not
require the rest of the Carbon framework and does not need an idle
function.
If you need to get a reply from the application, you might want to
use my direct dispatching library. It puts the result in an
NSInvocation for you. You can get it from http://homepage.mac.com/
d_j_v/FileSharing3.html.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden