• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to reply to Apple Events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to reply to Apple Events


  • Subject: Re: How to reply to Apple Events
  • From: Bill Monk <email@hidden>
  • Date: Tue, 16 Aug 2005 09:49:54 -0500


On Aug 16, 2005, at 6:54 AM, Gerriet M. Denkmann wrote:

So, what am I supposed to do with such a replyEvent?

Probably fill it out with something like: "ok" or "error with reason".
But how?

You can fill it in using setParamDescriptor:forKeyword:

The needed AEKeywords are keyErrorNumber and (optionally) keyErrorMessage.

For example, this 'odoc' handler simply complains:

- (void)handleODOCEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent;
{
OSErr myErr = paramErr;


if ( (noErr != myErr) && ([replyEvent descriptorType] != typeNull) ) {

NSAppleEventDescriptor *errNumDesc = [NSAppleEventDescriptor descriptorWithInt32:myErr];
[replyEvent setParamDescriptor:errNumDesc forKeyword:keyErrorNumber];


NSAppleEventDescriptor *errStrDesc = [NSAppleEventDescriptor descriptorWithString:@"Complain."];
[replyEvent setParamDescriptor:errStrDesc forKeyword:keyErrorString];
}
}


And then send it back. But how?

It's only necessary to fill in the reply event; it will be returned automatically.


I don't see anything for sending replies in NSAppleEventManager.

There isn't anything. Sending Apple Events to other apps must be done with AESend() or AESendMessage() (which requires the Carbon or ApplicationServices frameworks, respectively). But you won't need any of that here.
_______________________________________________
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
  • Prev by Date: Subviews use superview's `drawRect' method?
  • Next by Date: Re: Subviews use superview's `drawRect' method?
  • Previous by thread: How to reply to Apple Events
  • Next by thread: Unsubscribe
  • Index(es):
    • Date
    • Thread