Re: Question about receiving 'odoc' events on launch
Re: Question about receiving 'odoc' events on launch
- Subject: Re: Question about receiving 'odoc' events on launch
- From: Brian Webster <email@hidden>
- Date: Wed, 16 Jan 2002 16:39:02 -0600
On Wednesday, January 16, 2002, at 04:18 PM, cocoa-dev-
email@hidden wrote:
I'm trying to set up a Cocoa application to receive 'odoc'
events on launch.
According to online documentation provided by Apple, scripting
support is
built in to Cocoa. but I have so far been unable to get my
application to
receive the event.
Well, the default 'odoc' event support isn't really part of the
scripting system per se, but rather is just handled
automatically by the NSApplication object.
So far, I have: - added bundle information to my applications'"
info.plist"
and set the NSAppleScriptEnabled key to "YES".
The NSAppleScriptEnabled key shouldn't affect the behaviour for
opening documents, but it won't hurt either way to have it on or
off.
- added a delegate to NSApplication to handle openFile.
According to the link above, and from perusing the code in the TextEdit
example (which handles 'odoc' events perfectly), that should be
enough to
capture the events. But my openFile delegate is not being
called. Any ideas
as to what am I leaving out?
Just a short checklist:
1. Do you have the app's delegate correctly connected in
Interface Builder? This should consist of a control-drag from
the File's Owner icon in MainMenu.nib to your controller object
in the nib file, and then selecting the delegate outlet in the
inspector panel.
2. Do you have the method implemented in the correct class and
is the method spelled correctly? The method should read:
- (BOOL)application:(NSApplication *)theApplication
openFile:(NSString *)filename
--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster