[futurebasic] RE: [FB] replying to appleevents

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 2002 : Group Archive : Group : All Groups

From: "Edwards, Waverly" <Waverly.Edwards@...>
Date: Mon, 28 Oct 2002 12:10:12 -0500
After quite a bit of experimenting this weekend I figured out that
a reply is given after the task is complete.  You can ask the server
to do a million other tasks but the reply will only be returned 
at the end of your handler routine or a timeout occurs.  If you choose 
_kAEWaitReply as an option you will always have a reply returned.  Its
up to you to add information to the reply.

I thought that if you didnt add anything to the reply then the client
would show that as no reply returned.


W.


CLIENT
err = FN AESend( appleEvent, replyEvent,
_kAEWaitReply_kAEneverInteract,_kAEHighPriority ,tickToWait,myIdleProc,0 )



SERVER
local fn handleAEEvent(theAEevent, theReply)
doThisFunction
doThatFunction
doAnotherFunction
doStillAnotherFunction
end fn

"AppleeventProcInServer"
enterproc MyEventHandler (theAppleEvent as ^AppleEvent, reply as
^AppleEvent, handlerRefcon as long )
fn handleAEEvent(theAppleEvent, reply)
// reply is returned after all handler
// routines are complete.
exitproc = result%




-----Original Message-----
From: Edwards, Waverly [mailto:Waverly.Edwards@...]
Sent: Thursday, October 24, 2002 3:07 PM
To: 'futurebasic@...'
Subject: RE: [FB] replying to appleevents



I checked out the example and it was pretty close to
what I had done to send and wait for a reply.

This may seem like a silly question but from all that
I've read once you've sent an appleevent with the
attribute of _kaewaitreply that it waits for the reply, 
or the time out period to elapse or a cancellation occurs
if the idle procedure supports it.

tickToWait = 600 // 10 seconds

err = FN AESend( appleEvent, replyEvent,
_kAEWaitReply_kAEneverInteract,_kAEHighPriority ,tickToWait,myIdleProc,0 )


When I send the event even if I intentionally 
dont reply it returns immediately.  Many times 
the server is finished in the blink of an eye 
but there are defintely going to be times where
the server is going to be doing other processes
the client needs to wait on.

Anyone have an idea why my program doesnt wait until
the reply is returned or the timeout occurs?


Thanks,


W.



-----Original Message-----
From: Edwards, Waverly 

I worked it out last night.
After a *****LOT**** of pain I figured
out what it takes to reply to an event.
It doesn't really take that much BUT it
was the journey that hurt.

<snip>

I'll look at the code and see what I'm doing wrong
or is that just the way it is.


-----Original Message-----
From: Robert Purves [mailto:robert.purves@...]
Sent: Wednesday, October 23, 2002 4:40 AM
To: futurebasic@...
Subject: Re: [FB] replying to appleevents



On Wednesday, October 23, 2002, at 11:08  AM, Edwards, Waverly wrote:

>> and then, in the words of the immortal mrs beeton
>> "first catch your appleevent".*
>> <<
>
> Thanks,
>
> I also know how to catch the event but Apple says
> "stuff" reply back into the event and I cant seem
> to find any further information on how to "stuff"
> it.
>
> http://developer.apple.com/technotes/ic/ic_505.html
>
>> If your application is just sending a reply, it should not be 
>> creating an
>> Apple event or calling AESend. Instead, the Apple event handler 
>> should stuff
>> the response information into the reply event, as shown on page 6-50 
>> of
>> Inside Macintosh Volume VI. The Apple Event Manager takes care of 
>> addressing
>> and sending the event....
>
> Once the appleevent is received then it looks I need to use 
> AEPutParamPtr to
> put the reply back into the appleevent but this doesnt make much sense.

< snip >

There is an example "Trash AEvent (+idleProc)" in the Release 7 CD, 
that shows how to send a reply.
Look in    Examples:** Donations **:

Robert P.


--
To unsubscribe, send ANY message to <futurebasic-unsubscribe@...>

--
To unsubscribe, send ANY message to <futurebasic-unsubscribe@...>

--
To unsubscribe, send ANY message to <futurebasic-unsubscribe@...>