Jump to content

Recommended Posts

Posted

Hi,

If I'm reading the code in UIAWrappers.au3 correctly, the function _UIA_getObjectByFindAll( ) uses the UIElement.FindAll with the true condition, so it would find any elements that match the treescope passed in.  This populates an array, and then it iterates through them and tries matching the properties that were passed into _UIA_getObjectByFindAll and returns the first element that is the best match.

I understand one can use the index or relativeindex properties to target a specific child, let's say when you have a panel that has a bunch of edit fields.  If you know the specific index of the one you want you can use the index to get it back, but what if I want to return, say the whole array of UIElements that match a specific type.

Is my best option here to just use the .FindAll( ) function directly and set my own condition to match the controltypeid?

 

 

Posted

Bizarre that I cannot find any child elements.  Anyone know what I'm doing wrong here?

Local $vehInfo = _UIA_getObjectByFindAll($oWindow, "Title:=Display vehicle information for RO", $treescope_subtree)
    If Not IsObj( $vehInfo ) Then Return elog("Could not find vehicle information popup dialog")
    
    Local $pUIElementArray, $oUIElementArray, $iElements
    $vehInfo.FindAll( $treescope_subtree, $UIA_oTRUECondition, $pUIElementArray )
    $oUIElementArray = ObjCreateInterface( $pUIElementArray, $sIID_IUIAutomationElementArray, $dtagIUIAutomationElementArray )
    $oUIElementArray.Length( $iElements )
    If Not ( $iElements = 1 ) Then Exit ConsoleWrite( "$iElements ERR" & @CRLF )
    ConsoleWrite( "$iElements OK" & @CRLF )

I have a handle on the element with the title "Display vehicle information for RO", and when I do a FindAll on it, it returns empty, but showing the inspect.exe screenshot it has child elements.  Why am I coming up empty?

Screen Shot 2017-11-28 at 3.35.03 PM.png

Posted

Solved it.  The loop was wrong.  It was copy/paste from another example.  Didn't realize it was trying to ensure there was only one element in the array when I was looking for more.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...