Re: path name from Apple Event
Re: path name from Apple Event
- Subject: Re: path name from Apple Event
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Sun, 14 Aug 2005 21:37:29 +0200
On 14.08.2005, at 17:13, James Spencer <email@hidden> wrote:
On Aug 14, 2005, at 7:28 AM, Gerriet M. Denkmann wrote:
My app gets an Apple Event: eventClass: 'aevt', eventID: 'odoc' .
NSAppleEventDescriptor *dio = [ event descriptorForKeyword:
keyDirectObject ];
This has the descriptorType 'list' and contains (among other data)
a path name.
But how do I get this path name as NSString ?
[ dio stringValue ] just returns nil.
I'm not sure why you are doing this because normally Cocoa parses out
the open doc Apple Event and sends your application delegate an
application: openFiles: message. See http://developer.apple.com/
documentation/Cocoa/Conceptual/Scriptability/index.html
Well, the odoc event comes from Xcode and sometimes contains not only a
path name, but also a line number. And the receiver is an editor, which
needs the line number to highlight it.
If I not intercept the event, the document would open, but the line
would never be highlighted.
However, assuming you have a good reason for taking it over yourself,
the list doesn't contain a path name nor is it "among other data";
rather, the list contains one or more AE descriptors which contain
aliases for the files to be opened. You have to extract each of
these descriptors and get the data out of them. This being true, it
isn't the string value of the list that you want but rather the
string value of the individual elements of the list.
Well, I asked the dio (see above) about numberOfItems, it said 1. And [
dio descriptorAtIndex: 0 ] returned nil.
So again: how do I get my path name ?
Kind regards,
Gerriet.
_______________________________________________
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