Re: Custom handling for 'odoc' events
Re: Custom handling for 'odoc' events
- Subject: Re: Custom handling for 'odoc' events
- From: Martin Ott <email@hidden>
- Date: Sat, 19 Apr 2003 19:21:08 +0200
Have a look at the class NSAppleEventManager, it has the method
- (void)setEventHandler:(id)handler andSelector:(SEL)sel
forEventClass:(AEEventClass)eventClass andEventID:(AEEventID)eventID that
might do what you want.
Thanks for the hint. I overlooked this. But it also doesn't work for me.
I set an event handler for the EventClass kCoreEventClass aka 'aevt' and
the EventID to kAEOpenDocuments aka 'odoc'. When I used LaunchServices to
open documents in my app the handler was ignored completely. The
following script triggered my handler:
tell application "MyApp"
open file "somefile"
end tell
Now I have it working. Every incoming 'odoc' event is now triggering my
handler. In my previous attempt I registered my handler in awakeFromNib in
the app controller which was also the receiver of the handler method. Now I
registered the handler in NSApplication's delegate methods
applicationWillFinishLaunching:. The receiver of the handler method is also
NSApplication which I extended using a Category. The problem now is that
you have to do everything which Cocoa does for you when it receives such an
event. All what I want are the parameters sent with the event.
So it would be more convenient when an aevt/odoc event would turn into a
ScriptCommand when received by the application. NSCoreSuite already defines
a command for such events but when such an event arrives it doesn't seem to
turn into a ScriptCommand object. Is this correct? Can I override the
command in my suite?
The problem is that Project Builder (which plays the server role for the
ODB Editor Suite implementation) uses LaunchServices or some API which is
built on top LaunchServices. Which Apple event sends LaunchServices when
opening an app with documents?
LaunchServices obviously generates aevt/odoc events when opening documents
in an application.
I have found out how to track the events sent around in your system. You
have to set the following environments variables to log them to the console:
AEDebug=1
AEDebugReceives=1
AEDebugSends=1
Cheers,
--
Martin Ott Email: email@hidden
Institut fuer Informatik
Technische Universitaet Muenchen
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.