myu8171 Posted June 16, 2024 Posted June 16, 2024 (edited) Need to click the Save button. Unfortunately the button doesn't have name property ID as other buttons, so have to loop over all buttons and find the one without name, or use the 1st returned button item. Code below didn't find buttons. The FindAll function returns 0 (NULL). Any suggestion why? Thanks. UPDATE: Figured out. A subtle error caused the issue. ; --- Find all Button elements within the toolbar --- ConsoleWrite("--- Find all Button elements within the toolbar ---" & @CRLF) Local $oConditionButton $oUIAutomation.CreatePropertyCondition($UIA_ControlTypePropertyId, $UIA_ButtonControlTypeId, $oConditionButton) Local $oButtonElements $oToolBar3.FindAll($TreeScope_Descendants, $oConditionButton, $oButtonElements) If IsObj($oButtonElements) Then For $i = 0 To $oButtonElements.Length - 1 Local $oButtonElement = $oButtonElements.GetElement($i) Local $oButton = ObjCreateInterface($oButtonElement, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) ; Output properties of the button element Local $sName = "" $oButton.GetCurrentPropertyValue($UIA_NamePropertyId, $sName) ConsoleWrite("Button " & $i & ": Name=" & $sName & @CRLF) ; If the button has no name, interact with it If $sName = "" Then ConsoleWrite("Interacting with unnamed button" & @CRLF) _UIA_ClickElement($oButton) ExitLoop EndIf Next Else ConsoleWrite("No Button elements found in the toolbar." & @CRLF) EndIf Edited June 18, 2024 by myu8171 update
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now