Reputation: 1429
In the process of modernizing a carbon app, I'd like to rewrite the handing of AppleEvents in Cocoa, especially because I find the Carbon AEFunctions quite ugly.
I found NSAppleEventDescriptor but I'm confused about how to create one from an AppleEvent* in order to easier access its elements.
Upvotes: 2
Views: 286
Reputation: 90601
An AppleEvent
is an AERecord
is an AEDescList
is an AEDesc
. So, you can create an NSAppleEventDescriptor
using -initWithAEDescNoCopy:
.
That said, if you're writing Apple Event handlers in Cocoa, then you should register them with -[NSAppleEventManager setEventHandler:andSelector:forEventClass:andEventID:]
. Your handler method would then receive an NSAppleEventDescriptor
as a parameter and you wouldn't have to worry about constructing one from an AppleEvent
.
Upvotes: 3