• 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 Source of Apple Event
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding Source of Apple Event


  • Subject: Re: Finding Source of Apple Event
  • From: email@hidden
  • Date: Mon, 5 Feb 2007 16:42:18 +0100

Hello Tommy,

This is not entirely trivial, but here is a method that I use. It shows you the most important steps:

- (void)handleOpenDocumentsEvent:(NSAppleEventDescriptor *)event
                  withReplyEvent:(NSAppleEventDescriptor *)replyEvent
{
    OSErr err;
    ProcessSerialNumber appPSN;
    DescType returnedType;
    Size actualSize;
    NSDictionary *appInfo;

appPSN.highLongOfPSN = 0;
appPSN.lowLongOfPSN = kNoProcess;
appInfo = nil;
// Whodunnit?
err = AEGetAttributePtr([event aeDesc], keyAddressAttr, typeProcessSerialNumber,
&returnedType, &appPSN, sizeof(appPSN), &actualSize);
if (noErr == err && kNoProcess != appPSN.lowLongOfPSN)
{
appInfo = (NSDictionary *)ProcessInformationCopyDictionary ((const ProcessSerialNumberPtr)(&appPSN), kProcessDictionaryIncludeAllInformationMask);
[appInfo autorelease];
}
// The appInfo will contain all the information from the source


...snip...
}

Cheers!
Annard

On 5 Feb 2007, at 02:16, Tommy Nordgren wrote:

How can I find the App originating an Apple Event in Cocoa?
I need to do special processing when receiving Apple Events from a particular App.
----
Kine dies, Kinfolk dies, and thus at last yourself
This I know that never dies, how a dead mans deeds are deemed. -- Elder edda
Tommy Nordgren
email@hidden




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Finding Source of Apple Event (From: Tommy Nordgren <email@hidden>)

  • Prev by Date: RS plotting functions
  • Next by Date: Re: Controlling RAW Camera file conversion in NSImage
  • Previous by thread: Finding Source of Apple Event
  • Next by thread: Sorting numerical strings in a table
  • Index(es):
    • Date
    • Thread