Re: (More) Re: NSAppleEventDescriptor/AEKeyword question
Re: (More) Re: NSAppleEventDescriptor/AEKeyword question
- Subject: Re: (More) Re: NSAppleEventDescriptor/AEKeyword question
- From: Mark Piccirelli <email@hidden>
- Date: Tue, 10 Sep 2002 19:21:47 -0700
If coercing to typeUnicodeText doesn't work, and you're pretty sure
that the NSAppleEventDescriptor in question really is typeAlias, it
looks like there's no coercion from typeAlias to typeUnicodeText
installed by default. It looks like you'll have to:
Get the alias record out of the NSAppleEventDescriptor using
-[NSAppleEventDescriptor data].
Make a handle memory object out of the alias record using something
like Carbon's PtrToHand(), because all of the Carbon alias APIs still
require alias handles.
Use one of the Carbon Alias Manager functions to resolve the alias to
an FSRef.
Use CFURLCreateFromFSRef() and CFURLCopyPath() to finally make a
CFStringRef, which you can coerce to an NSString*.
You'll of course have to eventually dispose what PtrToHand() returns,
and release what CFURLCreateFromFSRef() and CFURLCopyPath() return.
Pretty ugly I know, but that might really be what it takes right now.
I think maybe I should start considering the addition of an
-[NSAppleEventDescriptor urlValue] method or something like that...
-- Mark
On Friday, September 6, 2002, at 06:07 PM, Matt Gemmell wrote:
Hi again,
Further to my email quoted below, I've discovered that an AEKeyword is
simply, for example, 'Hdfn'. Embarrassingly simple!
That works fine for the property which returns a string, since I can
retrieve that string using NSAppleEventDescriptor's -stringValue
instance method. However, the other property I need to make use of
('HRdr') returns not a string but an alias. I'm not sure how to
retrieve the path from that alias as an NSString.
I've tried using -coerceToDescriptorType:'utxt' (coercing to
typeUnicodeText), but that doesn't seem to work. Any ideas?
Hi there,
I've used the new NSAppleScript class to retrieve BBEdit's html
preferences, by executing the AppleScript:
tell application "BBEdit 6.5" to get html preferences
This returns the correct NSAppleEventDescriptor, with 12 items in it.
I need to access two of those items, specifically the "default file
name" and "root directory" items. I presume I need to use
NSAppleEventDescriptor's -descriptorForKeyword: instance method (I
don't want to use -descriptorAtIndex: in case the items are returned
in a different order in a future version of BBEdit). The
-descriptorForKeyword: method takes an AEKeyword as its argument.
Now, I'm not exactly sure what an AEKeyword is, or what I need to use
for it in this situation. I've opened BBEdit's scripting dictionary
in Script Debugger, viewing it as "AppleEvents", and I see that the
"default file name" property corresponds to the code "HDfn", and the
"root directory" property corresponds to "HRdr". I'm not sure if
that's relevant here or not.
Could someone enlighten me as to how to construct appropriate
AEKeywords?
_______________________________________________
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.