• 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: Finding the sender of an AppleEvent in Cocoa app on 10.2.8 or greater
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding the sender of an AppleEvent in Cocoa app on 10.2.8 or greater


  • Subject: Re: Finding the sender of an AppleEvent in Cocoa app on 10.2.8 or greater
  • From: Greg Robbins <email@hidden>
  • Date: Fri, 14 Jan 2005 12:31:13 -0800

At 11:54 AM -0800 1/14/05, Shawn Erickson wrote:
I have tried the various obvious method provided by the AE related Cocoa class to fetch the original sender (mostly trying to get its PSN) but it looks like the data isn't in the event since the plugin doesn't request a reply, etc.

You can register to get the actual event with NSAppleEventManaager's setEventHandler:andSelector:forEventClass:andEventID: then extract the sender's signature or ProcessSerialNumber directly from the event:


NSAppleEventDescriptor *addrDesc = [event attributeDescriptorForKeyword:keyAddressAttr];
NSData *psnData = [[addrDesc coerceToDescriptorType:typeProcessSerialNumber] data];


if (psnData)
{
ProcessSerialNumber psn = *(ProcessSerialNumber *) [psnData bytes];
}
else
{
NSData *sigData = [[addrDesc coerceToDescriptorType:typeApplSignature] data];
if (sigData)
{
OSType sendersSignature = *(OSType *) [sigData bytes];
}


}

You can convert between process serial number and sender signature by walking the process list (GetNextProcess/GetProcessInformation) and looking for the process with the proper signature.

Greg Robbins
_______________________________________________
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


  • Follow-Ups:
    • Re: Finding the sender of an AppleEvent in Cocoa app on 10.2.8 or greater
      • From: Shawn Erickson <email@hidden>
    • Re: Finding the sender of an AppleEvent in Cocoa app on 10.2.8 or greater
      • From: Shawn Erickson <email@hidden>
References: 
 >Finding the sender of an AppleEvent in Cocoa app on 10.2.8 or greater (From: Shawn Erickson <email@hidden>)

  • Prev by Date: Re: Finding the sender of an AppleEvent in Cocoa app on 10.2.8 or greater
  • Next by Date: Re: Finding the sender of an AppleEvent in Cocoa app on 10.2.8 or greater
  • Previous by thread: Finding the sender of an AppleEvent in Cocoa app on 10.2.8 or greater
  • Next by thread: Re: Finding the sender of an AppleEvent in Cocoa app on 10.2.8 or greater
  • Index(es):
    • Date
    • Thread