Re: AXUIElementCopyAttributeValue useage
Re: AXUIElementCopyAttributeValue useage
- Subject: Re: AXUIElementCopyAttributeValue useage
- From: Guy Fullerton <email@hidden>
- Date: Wed, 07 Jan 2004 18:11:47 -0800
(Let's see if I can answer this before the others do...)
On 1/7/04 5:52 PM, "Modesitt Software" <email@hidden> wrote:
>
What about extracting a string? My code first does this:
>
CFTypeRef cfRef;
>
axErr = ::AXUIElementCopyAttributeValue( inElement, kAXTitleAttribute,
>
&cfRef );
In this case, the return value from AXUIElementCopyAttributeValue *is* a
CFString. Just cast it:
CFStringRef theCFStr = (CFStringRef)cfRef;
(Of course, you probably also want to validate that cfRef is non-NULL and
has a CFTypeID equaling CFStringGetTypeID.)
>
Then I do this to get the title as a Pascal string:
>
CFStringRef theCFStr = ::CFCopyDescription(cfRef);
>
Str255 theStr;
>
bool value = ::CFStringGetPascalString( theCFStr, theStr, 256,
>
kCFStringEncodingMacRoman);
>
>
theStr now contains this:
>
"\p<CFString 0x6a9eb0 [0xa01900e0]>{contents = \"Re:
>
AXUIElementCopyAttributeValue useage\"}"
>
>
Is there a method to extract just the contents of CFStringRef? Right
>
now I parse it, looking for the quote characters, but it seems error
>
prone.
>
>
Thanks!
>
-Bill
>
>
>
>
On Jan 6, 2004, at 10:50 PM, John Louch wrote:
>
> Check to see if cfRef is equal to kCFBooleanTrue or kCFBooleanFalse.
>
>
>
> I.e.
>
>
>
> if (cfRef == kCFBooleanTrue)
>
> {
>
> // its true
>
> }
>
> else // assuming cfRef != nil
>
> {
>
> // its false
>
> }
>
>
>
>> In my code I use AXUIElementCopyAttributeValue on a window in this
>
>> manner:
>
>>
>
>> CFTypeRef cfRef;
>
>> axErr = ::AXUIElementCopyAttributeValue( inElement, kAXModalAttribute,
>
>> &cfRef );
>
>>
>
>> Then I get the pascal string from cfRef, and it looks like this:
>
>> "<CFBoolean 0xa0190b98 [0xa01900e0]>{value = false}"
>
>>
>
>> It has the information I want, but how do I extract it? Do I have to
>
>> search the string for the sub-string "value=false" or "value=true" to
>
>> determine the value?
>
>> Or is there some function that tells me it's a Boolean value, and the
>
>> value is true (or false)?
>
>>
>
>> thanks!
>
>> Bill
>
>> _______________________________________________
>
>> accessibility-dev mailing list | email@hidden
>
>> Help/Unsubscribe/Archives:
>
>> http://www.lists.apple.com/mailman/listinfo/accessibility-dev
>
>> Do not post admin requests to the list. They will be ignored.
>
>
>
> --------------------------------------------------
>
> John Louch Internet #: email@hidden
>
> (805) 546 0216
>
_______________________________________________
>
accessibility-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/accessibility-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
accessibility-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/accessibility-dev
Do not post admin requests to the list. They will be ignored.