Re: Comparing AXUIElementRefs? AXUIElementCopyElementAtPosition(systemWide)
Re: Comparing AXUIElementRefs? AXUIElementCopyElementAtPosition(systemWide)
- Subject: Re: Comparing AXUIElementRefs? AXUIElementCopyElementAtPosition(systemWide)
- From: Bill Cheeseman <email@hidden>
- Date: Fri, 02 Jun 2006 04:57:13 -0400
- Thread-topic: Comparing AXUIElementRefs? AXUIElementCopyElementAtPosition(systemWide)
on 2006-06-01 6:43 PM, Tom Bunch at email@hidden wrote:
> I need to know if the AXUIElement at x,y is the same element it was
> last time I asked, but AXUIElementRef is an opaque structure and
> every time I make a call AXUIElementCopyElementAtPosition
> (systemWide...), all other things being the same, I get a different
> AXUIElementRef back. I'm not convinced I have any way to accomplish
> this. I could compare certain attribute values, but the element may
> have moved, so the position and size may have changed. AXValues
> change all the time.
>
> Is there a CFComparatorFunction or some kind of reliable GUID I can
> get from these guys?
Use CFEqual. These are just CFTypeRefs. I believe two AXUIElementRef objects
that are CFEqual are, by definition, references to the same UI element no
matter what its position on the screen. You can create as many
AXUIElementRef objects as you like for any one UI element and use them
interchangeably. It is often convenient to create a temporary AXUIElementRef
on the fly and CFRelease it a moment later, for example, if you want to test
an existing element to see if it refers to that UI element (using CFEqual).
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
PreFab Software - http://www.prefab.com/scripting.html
The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden