Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Event Handler reply



I have this event handler registered in my application:

[[NSAppleEventManager sharedAppleEventManager] setEventHandler:self andSelector:@selector(handleGetExtensionPreferencesIDEvent:withReplyEvent:) forEventClass:kTansaCoreEventClass andEventID:kGetExtensionPreferencesID];

and the handler routine itself:

- (void) handleGetExtensionPreferencesIDEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent {
[replyEvent setParamDescriptor:[[NSAppleEventDescriptor descriptorWithString:@""] coerceToDescriptorType:'TEXT'] forKeyword:keyDirectObject];
AppleEvent *replyEventPtr = (AEDesc *)[replyEvent aeDesc];
if (replyEventPtr)
AESendMessage(replyEventPtr, NULL, kAENoReply, kAEDefaultTimeout);
}

I get the AppleEvent TANS/tgep from the client application, and am supposed to reply to it.
The aevt/ansr I return in the replyEvent looks almost correct.
But instead of { 2 } 'aevt':  aevt/ansr (i386) there should have been { 1 } 'aevt':  aevt/ansr (i386)
And instead of reply port: 26883 (0x6903) there should have been reply port: 0 (0x0)
etc.
The complete correct reply is shown at the bottom of this message, taken from an older Carbon application I am porting to Cocoa.
I am thinking that I am returning the replyEvent in a wrong way, should I return it in an AESendMessage?
I will be very grateful for any help here.

Ivan


------oo  end of event  oo------
AE2000 (5007): Received an event:
------oo start of event oo------
{ 1 } 'aevt':  TANS/tgep (i386){
          return id: 220135528 (0xd1f0068)
     transaction id: 0 (0x0)
  interaction level: 112 (0x70)
     reply required: 1 (0x1)
             remote: 0 (0x0)
      for recording: 0 (0x0)
         reply port: 26883 (0x6903)
  target:
    { 1 } 'psn ':  8 bytes {
      { 0x0, 0xd80d8 } (InCopy)
    }
  fEventSourcePSN: { 0x0,0xd80d8 } (InCopy)
  optional attributes:
    < empty record >
  event data:
    { 1 } 'aevt':  - 0 items {
    }
}

------oo  end of event  oo------
AE2000 (5007): Sending an event:
------oo start of event oo------
{ 2 } 'aevt':  aevt/ansr (i386){
          return id: 220135528 (0xd1f0068)
     transaction id: 0 (0x0)
  interaction level: 112 (0x70)
     reply required: 0 (0x0)
             remote: 0 (0x0)
      for recording: 0 (0x0)
         reply port: 26883 (0x6903)
  target:
    { 2 } 'psn ':  8 bytes {
      { 0x0, 0xd80d8 } (InCopy)
    }
  fEventSourcePSN: { 0x0,0xfa0fa } (Tansa)
  optional attributes:
    < empty record >
  event data:
    { 2 } 'aevt':  - 1 items {
      key '----' - 
        { 1 } 'TEXT':  0 bytes {
          ""
        }
    }
}

This is how the reply should have looked like (if you disregard the return id):

------oo  end of event  oo------
AE2000 (3359): Received an event reply:
------oo start of event oo------
{ 1 } 'aevt':  aevt/ansr (i386){
          return id: 220135439 (0xd1f000f)
     transaction id: 0 (0x0)
  interaction level: 112 (0x70)
     reply required: 0 (0x0)
             remote: 0 (0x0)
      for recording: 0 (0x0)
         reply port: 0 (0x0)
  target:
    { 1 } 'psn ':  8 bytes {
      { 0x0, 0xd90d9 } (Tansa)
    }
  fEventSourcePSN: { 0x0,0xd90d9 } (Tansa)
  optional attributes:
    < empty record >
  event data:
    { 1 } 'aevt':  - 1 items {
      key '----' - 
        { 1 } 'TEXT':  0 bytes {
          ""
        }
    }
}



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-implementors mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-implementors/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.