mkander Posted February 10, 2019 Share Posted February 10, 2019 Hi! I am working on automating a program we use at work. I need to select the correct row in a table. I have found the table in UIASpy. All rows are listed as children of the table in UIASpy. Is there any way to loop through the children of an element? I locate the table by UIA_NamePropertyId, just need a way to loop through children now. Thanks for all help! Magnus Link to comment Share on other sites More sharing options...
mkander Posted February 10, 2019 Author Share Posted February 10, 2019 Found a workaround, never mind Link to comment Share on other sites More sharing options...
LarsJ Posted February 10, 2019 Share Posted February 10, 2019 There will be a major update in a week or two mainly about sample code creation. After that more advanced topics as you are facing will be treated. Hopefully within a month or so. Regards Lars. mLipok 1 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
scslmd Posted March 21, 2019 Share Posted March 21, 2019 mkander: Can you please post your workaround. It'll help people who land on this page with similar question/problem. Thank you. Link to comment Share on other sites More sharing options...
wljdflgio Posted July 2, 2020 Share Posted July 2, 2020 I do have the same issue now. There is a "FindAll" instead of "FindFirst" which should work, however I have no Idea how to handle the AutomationelementCollection in autoIt https://docs.microsoft.com/de-de/dotnet/api/system.windows.automation.automationelement.findall?view=netcore-3.1#System_Windows_Automation_AutomationElement_FindAll_System_Windows_Automation_TreeScope_System_Windows_Automation_Condition_ I could not find any "access nth child"-method either. The TreeScope does not have a Siblings Value or similar, so this does not work either. Link to comment Share on other sites More sharing options...
junkew Posted July 2, 2020 Share Posted July 2, 2020 See uiautomation uiawrapper code which makes use of findall which just returns an array. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
wljdflgio Posted July 2, 2020 Share Posted July 2, 2020 (edited) Thank you. By now I basically ripped the code from UISpy for this task. I dont know yet why switches by Windows Version for $sIIDIUIAutomationElement and $dtagIUIAutomationElement - I used Win 7 parameters and it worked on Win 10. However the following does GetCurrentPropertyValue for all children of $oParent (if anyone else needs this for future tasks): $oParent.FindAll($TreeScope_Children, $pCondition, $pChilden) If Not $pChilden Then Return ConsoleWrite("$pChilden ERR" & @CRLF) ConsoleWrite("$pChilden OK" & @CRLF) Local $oAutomationElementArray, $iLength $oAutomationElementArray = ObjCreateInterface($pChilden, $sIID_IUIAutomationElementArray, $dtag_IUIAutomationElementArray) $oAutomationElementArray.Length($iLength) If Not $iLength Then Return ConsoleWrite("$iLength ERR" & @CRLF) Local $sIIDIUIAutomationElement, $dtagIUIAutomationElement $sIIDIUIAutomationElement = $sIID_IUIAutomationElement $dtagIUIAutomationElement = $dtag_IUIAutomationElement Local $pItem, $oItem For $i = 0 To $iLength - 1 $oAutomationElementArray.GetElement($i, $pItem) $oItem = ObjCreateInterface($pItem, $sIIDIUIAutomationElement, $dtagIUIAutomationElement) $oItem.GetCurrentPropertyValue($field_name,$value) Next Edited July 2, 2020 by wljdflgio Link to comment Share on other sites More sharing options...
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