Jump to content

Get property/status of control from _UIA_getObjectByFindAll

Recommended Posts

I am trying to "test" the value of a variable that's returned by the function '_UIA_getObjectByFindAll' (see code below).

I was expecting it to be as simple as a Boolean test. However, the code just loops until the timer runs out, as my variable '$objKey_Finish' seemingly never gets set.

If I uncomment this line:


the button gets clicked but, even so, the loop isn't exited until the timer runs out.

BTW, I have to use the stuff from UIWrapper.au3 as the Window Info tool is unable to get the various window handles, class names, etc. from the application. As seasoned AutoIters will spot, the code in the loop is lifted pretty much straight from 'SimplySpy.au3', just with the variable names changed to suit my naming convention.

Here's my code:

#include "Include\APISysConstants.au3"
#include "Include\CUIAutomation2.au3"
#include "Include\EditConstants.au3"
#include "Include\GUIConstantsEx.au3"
#include "Include\GUIEdit.au3"
#include "Include\GUIMenu.au3"
#include "Include\ISimpleDOM.au3"
#include "Include\MSAccessibility.au3"
#include "Include\Misc.au3"
#include "Include\UIAWrappers.au3"
#include "Include\WinAPI.au3"
#include "Include\WinAPIProc.au3"
#include "Include\WinAPISys.au3"
#include "Include\WindowsConstants.au3"

AutoItSetOption("MustDeclareVars", 1)

Dim $strEXE = $CmdLine[1]
Dim $strWindowTitle = "OpenStudio built using CMake Setup"
Dim $intKeyCount = 5
Dim $intCount


Func WaitForPopUp(ByRef $strWindowTitle)
    ; Wait for a window with the title "$strWindowTitle" to pop up
    ; then press the Enter key $intKeyCount times

        $intCount = $intCount + 1
    Until $intCount = $intKeyCount

    ; Wait 20 minutes for a window with the title "$strWindowTitle" to pop up
    ; then press the Finish key.

    Local $datStartTime = TimerInit()
    Local $objKey_Finish = False
    Local $objMainWindow
    Local $objKey_Finish_Parent
    Local $objKey_Finish

    While (TimerDiff($datStartTime) < (20 * 60000) And Not $objKey_Finish)


        ; Set $objMainWindow by finding the window with the title "OpenStudio built using CMake Setup"
        $objMainWindow=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=OpenStudio built using CMake Setup;controltype:=UIA_WindowControlTypeId;class:=Qt5QWindowIcon", $treescope_children)

        ; Change focus to that window

        ; Set $objKey_Finish_Parent by finding the window with the title "Finish Enter"
        $objKey_Finish_Parent=_UIA_getObjectByFindAll($objMainWindow, "Title:=;controltype:=UIA_CustomControlTypeId;class:=", $treescope_children)

        ; Set objKey_Finish_Parent by finding the UI element in the parent's window list
        $objKey_Finish=_UIA_getObjectByFindAll($objKey_Finish_Parent, "title:=Finish Enter;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree)


    If ($objKey_Finish) Then
        ; Now that we've found it, click it

        Return 0
        Return 1


Link to post
Share on other sites

check on



highlighting helps

_uia_getPropertyValue($objKey_Finish,"<your property")

See UIWrapper source for details on the properties you can get


Edited by junkew
Link to post
Share on other sites

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...