jugador Posted April 8, 2021 Share Posted April 8, 2021 (edited) @LarsJ want to retrieve data from DataGridView which have 6-Row(including header) & 5-Column. On searching forum found few post where you mention using UI Automation framework to extract data from GridView. expandcollapse popup#include "CUIAutomation2.au3" AutoItSetOption("WinTitleMatchMode", 2) ;Opt( "MustDeclareVars", 1 ) MainFunc() Func MainFunc() Local $App_Title = 'ABCD' If Not WinExists($App_Title) Then Exit $hWindow = WinGetHandle($App_Title) If Not $hWindow Then Return ConsoleWrite( "Window handle ERR" & @CRLF ) ConsoleWrite( "Window handle OK" & @CRLF ) ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) If Not IsObj( $oUIAutomation ) Then Return ConsoleWrite( "UI Automation object ERR" & @CRLF ) ConsoleWrite( "UI Automation object OK" & @CRLF ) ; Get UI Automation element from window handle Local $pWindow, $oWindow $oUIAutomation.ElementFromHandle( $hWindow, $pWindow ) $oWindow = ObjCreateInterface( $pWindow, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oWindow ) Then Return ConsoleWrite( "Automation element from window ERR" & @CRLF ) ConsoleWrite( "Automation element from window OK" & @CRLF ) ; Condition to find Edit elements Local $pCondition $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_EditControlTypeId, $pCondition ) If Not $pCondition Then Return ConsoleWrite( "Property condition ERR" & @CRLF ) ConsoleWrite( "Property condition OK" & @CRLF ) ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition0 $oUIAutomation.CreatePropertyCondition( $UIA_AutomationIdPropertyId, "DataGridView", $pCondition0 ) If Not $pCondition0 Then Return ConsoleWrite( "$pCondition0 ERR" & @CRLF ) ConsoleWrite( "$pCondition0 OK" & @CRLF ) Local $pTable1, $oTable1 $oWindow.FindFirst( $TreeScope_Descendants, $pCondition0, $pTable1 ) $oTable1 = ObjCreateInterface( $pTable1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oTable1 ) Then Return ConsoleWrite( "$oTable1 ERR" & @CRLF ) ConsoleWrite( "$oTable1 OK" & @CRLF ) EndFunc Window handle OK UI Automation object OK Automation element from window OK Property condition OK --- Find window/control --- $pCondition0 OK $oTable1 OK Now for DataGridView how do i 1) get the total number of columns 2) retrieve all the column Header 3) extract the data from DataGridViewTextBoxCell for Listview we do like this 1) _GUICtrlListView_GetColumnCount($hWnd) ;~ Retrieve the number of columns 2) _GUICtrlListView_GetColumn($hWnd, $iIndex) ;~ Retrieve Column header text 3) _GUICtrlListView_GetItemText( $hWnd, $iIndex [, $iSubItem = 0] ) ;~ Retrieves the text of an item or subitem Edited April 8, 2021 by jugador Link to comment Share on other sites More sharing options...
LarsJ Posted April 8, 2021 Share Posted April 8, 2021 Take a look at Patterns (actions) examples 7 (answering questions 1) and 3)) and 8 (answering question 2)). jugador 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...
jugador Posted April 9, 2021 Author Share Posted April 9, 2021 (edited) @LarsJ expandcollapse popup#include "CUIAutomation2.au3" AutoItSetOption("WinTitleMatchMode", 2) MainFunc() Func MainFunc() ; ++++++++++++++++++++++++ Local $App_Title = 'ABCD' If Not WinExists($App_Title) Then Exit Local $hndl_App = WinGetHandle($App_Title) If Not $hndl_App Then Return ConsoleWrite( "Window handle ERR" & @CRLF ) ConsoleWrite( "Window handle OK" & @CRLF ) ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) If Not IsObj( $oUIAutomation ) Then Return ConsoleWrite( "UI Automation object ERR" & @CRLF ) ConsoleWrite( "UI Automation object OK" & @CRLF ) ; Get UI Automation element from window handle Local $ptr_App, $o_App $oUIAutomation.ElementFromHandle( $hndl_App, $ptr_App ) $o_App = ObjCreateInterface( $ptr_App, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $o_App ) Then Return ConsoleWrite( "Automation element from window ERR" & @CRLF ) ConsoleWrite( "Automation element from window OK" & @CRLF ) ; ++++++++++++++++++++++++ ; ++++++++++++++++++++++++ ; --- Find DataGridView control --- ConsoleWrite( "--- Find DataGridView control ---" & @CRLF ) Local $p_DGcond0 $oUIAutomation.CreatePropertyCondition( $UIA_AutomationIdPropertyId, "DataGridView", $p_DGcond0 ) If Not $p_DGcond0 Then Return ConsoleWrite( "$p_DGcond0 ERR" & @CRLF ) ConsoleWrite( "$p_DGcond0 OK" & @CRLF ) Local $p_DGcond1 $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_TableControlTypeId, $p_DGcond1 ) If Not $p_DGcond1 Then Return ConsoleWrite( "$p_DGcond1 ERR" & @CRLF ) ConsoleWrite( "$p_DGcond1 OK" & @CRLF ) ; And condition Local $p_DGcond $oUIAutomation.CreateAndCondition( $p_DGcond0, $p_DGcond1, $p_DGcond ) If Not $p_DGcond Then Return ConsoleWrite( "$p_DGcond ERR" & @CRLF ) ConsoleWrite( "$p_DGcond OK" & @CRLF ) Local $ptr_DGridTable, $o_DGridTable $o_App.FindFirst( $TreeScope_Descendants, $p_DGcond, $ptr_DGridTable ) $o_DGridTable = ObjCreateInterface( $ptr_DGridTable, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $o_DGridTable ) Then Return ConsoleWrite( "$o_DGridTable ERR" & @CRLF ) ConsoleWrite( "$o_DGridTable OK" & @CRLF ) ; ++++++++++++++++++++++++ ; ++++++++++++++++++++++++ ConsoleWrite( "--- Find #Custom: Top Row# control ---" & @CRLF ) Local $p_TopRWcond0 $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_CustomControlTypeId, $p_TopRWcond0 ) If Not $p_TopRWcond0 Then Return ConsoleWrite( "$p_TopRWcond0 ERR" & @CRLF ) ConsoleWrite( "$p_TopRWcond0 OK" & @CRLF ) Local $ptr_TopRW, $o_TopRW $o_DGridTable.FindFirst( $TreeScope_Descendants, $p_TopRWcond0, $ptr_TopRW ) $o_TopRW = ObjCreateInterface( $ptr_TopRW, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $o_TopRW ) Then Return ConsoleWrite( "$o_TopRW ERR" & @CRLF ) ConsoleWrite( "$o_TopRW OK" & @CRLF ) ; ++++++++++++++++++++++++ EndFunc Window handle OK UI Automation object OK Automation element from window OK --- Find DataGridView control --- $p_DGcond0 OK $p_DGcond1 OK $p_DGcond OK $o_DGridTable OK --- Find #Custom: Top Row# control --- $p_TopRWcond0 OK $o_TopRW OK Now on selecting 'DataGridView' or 'Custom:Top Row' getting this onlyControl Patterns (element actions):- $UIA_IsLegacyIAccessiblePatternAvailablePropertyId True (LegacyIAccessiblePattern) but as per Patterns (actions) example to get Row & Column you do this Local $pGridPattern1, $oGridPattern1 $oList1.GetCurrentPattern( $UIA_GridPatternId, $pGridPattern1 ) $oGridPattern1 = ObjCreateInterface( $pGridPattern1, $sIID_IUIAutomationGridPattern, $dtagIUIAutomationGridPattern ) If Not IsObj( $oGridPattern1 ) Then Return ConsoleWrite( "$oGridPattern1 ERR" & @CRLF ) ConsoleWrite( "$oGridPattern1 OK" & @CRLF ) ; --- Control Pattern Properties --- ConsoleWrite( "--- Control Pattern Properties ---" & @CRLF ) Local $iGridColumnCount1 $oList1.GetCurrentPropertyValue( $UIA_GridColumnCountPropertyId, $iGridColumnCount1 ) ConsoleWrite( "$iGridColumnCount1 = " & $iGridColumnCount1 & @CRLF ) Local $iGridRowCount1 $oList1.GetCurrentPropertyValue( $UIA_GridRowCountPropertyId, $iGridRowCount1 ) ConsoleWrite( "$iGridRowCount1 = " & $iGridRowCount1 & @CRLF ) for Header ; --- Table Pattern (action) Object --- ConsoleWrite( "--- Table Pattern (action) Object ---" & @CRLF ) Local $pTablePattern1, $oTablePattern1 $oList1.GetCurrentPattern( $UIA_TablePatternId, $pTablePattern1 ) $oTablePattern1 = ObjCreateInterface( $pTablePattern1, $sIID_IUIAutomationTablePattern, $dtagIUIAutomationTablePattern ) If Not IsObj( $oTablePattern1 ) Then Return ConsoleWrite( "$oTablePattern1 ERR" & @CRLF ) ConsoleWrite( "$oTablePattern1 OK" & @CRLF ) ; --- Table Pattern (action) Methods --- ConsoleWrite( "--- Table Pattern (action) Methods ---" & @CRLF ) Local $pElements $oTablePattern1.GetCurrentColumnHeaders( $pElements ) ConsoleWrite( "$oTablePattern1.GetCurrentColumnHeaders()" & @CRLF ) ; --- Code Snippets --- ConsoleWrite( "--- Code Snippets ---" & @CRLF ) Local $oAutomationElementArray1, $iLength1 ; $pElements is a pointer to an UI Automation element array $oAutomationElementArray1 = ObjCreateInterFace( $pElements, $sIID_IUIAutomationElementArray, $dtagIUIAutomationElementArray ) $oAutomationElementArray1.Length( $iLength1 ) If Not $iLength1 Then Return ConsoleWrite( "$iLength1 = 0 ERR" & @CRLF ) ConsoleWrite( "$iLength1 = " & $iLength1 & @CRLF ) So now how i proceed to to get the Header & total Row/Column. Edited April 9, 2021 by jugador Link to comment Share on other sites More sharing options...
LarsJ Posted April 10, 2021 Share Posted April 10, 2021 You continue with MSAA automation code. That only the LegacyIAccessible pattern is identified in the GridView control is a clear indication that only MSAA code but not UIA code is supported. Unfortunately, not much MSAA automation code has been implemented in AutoIt. But there's still something you can do. Initially, you can examine how much information it's possible to obtain through the LegacyIAccessible pattern. In addition, you can almost always perform mouse clicks and read texts in edit controls. If that isn't enough to provide the necessary information, then there's probably nothing left but MSAA, OCR and image techniques. jugador 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...
jugador Posted April 10, 2021 Author Share Posted April 10, 2021 (edited) @LarsJ I use this code of yours. expandcollapse popup#include "CUIAutomation2.au3" #include "MSAccessibility.au3" AutoItSetOption("WinTitleMatchMode", 2) Example() Func Example() ; ++++++++++++++++++++++++ Local $App_Title = 'ABCD' If Not WinExists($App_Title) Then Exit Local $hndl_App = WinGetHandle($App_Title) If Not $hndl_App Then Return ConsoleWrite( "App handle ERR" & @CRLF ) ConsoleWrite( "App handle OK" & @CRLF ) Local $hWindow = ControlGetHandle($hndl_App, '', '[NAME:DataGridView]') ; ++++++++++++++++++++++++ ; ++++++++++++++++++++++++ ; Get Window object Local $pWindow, $oWindow AccessibleObjectFromWindow( $hWindow, $OBJID_CLIENT, $tIID_IAccessible, $pWindow ) $oWindow = ObjCreateInterface( $pWindow, $sIID_IAccessible, $dtagIAccessible ) If Not IsObj( $oWindow ) Then Return ConsoleWrite( "Window object ERR" & @CRLF ) ConsoleWrite( "Window object OK" & @CRLF ) ; ++++++++++++++++++++++++ ; ++++++++++++++++++++++++ ; Window name Local $sName ConsoleWrite( @CRLF & "Window:" ) ConsoleWrite( @CRLF & "-------" & @CRLF ) PrintElementInfo( $oWindow, $CHILDID_SELF, "" ) ; ++++++++++++++++++++++++ ; ++++++++++++++++++++++++ ; Get children ConsoleWrite( "Children:" & @CRLF ) ConsoleWrite( "---------" & @CRLF ) WalkTreeWithAccessibleChildren( $pWindow, 0 ) ; ++++++++++++++++++++++++ EndFunc Func WalkTreeWithAccessibleChildren( $pAcc, $iLevel, $iLevels = 0 ) If $iLevels And $iLevel = $iLevels Then Return ; Create object Local $oAcc = ObjCreateInterface( $pAcc, $sIID_IAccessible, $dtagIAccessible ) If Not IsObj( $oAcc ) Then Return $oAcc.AddRef() Local $iChildCount, $iReturnCount, $tVarChildren ; Get children If $oAcc.get_accChildCount( $iChildCount ) Or Not $iChildCount Then Return If AccessibleChildren( $pAcc, 0, $iChildCount, $tVarChildren, $iReturnCount ) Then Return ; Indentation Local $sIndent = "" For $i = 0 To $iLevel - 1 $sIndent &= " " Next Local $hWnd WindowFromAccessibleObject( $pAcc, $hWnd ) ConsoleWrite( $sIndent & "Window = " & $hWnd & @CRLF & @CRLF ) Local $vt, $pChildObj, $oChildObj, $iChildElem ; For each child For $i = 1 To $iReturnCount ; $tVarChildren is an array of VARIANTs with information about the children $vt = BitAND( DllStructGetData( $tVarChildren, $i, 1 ), 0xFFFF ) If $vt = $VT_DISPATCH Then ; Child object $pChildObj = DllStructGetData( $tVarChildren, $i, 3 ) $oChildObj = ObjCreateInterface( $pChildObj, $sIID_IAccessible, $dtagIAccessible ) If IsObj( $oChildObj ) Then PrintElementInfo( $oChildObj, $CHILDID_SELF, $sIndent ) WalkTreeWithAccessibleChildren( $pChildObj, $iLevel + 1, $iLevels ) EndIf Else ; $vt = $VT_I4 ; Child element $iChildElem = DllStructGetData( $tVarChildren, $i, 3 ) PrintElementInfo( $oAcc, $iChildElem, $sIndent ) EndIf Next EndFunc expandcollapse popupWindow handle OK Window object OK Window: ------- $sName = DataGridView $iRole = 0x00000018 $sRole = table $iState = 0x00100004 $sState = focusable $sValue = $x, $y, $w, $h = 2, 122, 1368, 580 Children: --------- Window = 0x00050296 $sName = Top Row $iRole = 0x0000001C $sRole = row $iState = 0x00000000 $sState = normal $sValue = Top Row $x, $y, $w, $h = 2, 122, 1368, 22 Window = 0x00050296 $sName = High $iRole = 0x00000019 $sRole = column header $iState = 0x00200000 $sState = selectable $sValue = High $x, $y, $w, $h = 2, 122, 61, 22 $sName = Open $iRole = 0x00000019 $sRole = column header $iState = 0x00200000 $sState = selectable $sValue = Open $x, $y, $w, $h = 63, 122, 64, 22 $sName = Low $iRole = 0x00000019 $sRole = column header $iState = 0x00200000 $sState = selectable $sValue = Low $x, $y, $w, $h = 127, 122, 64, 22 $sName = Prev close $iRole = 0x00000019 $sRole = column header $iState = 0x00200000 $sState = selectable $sValue = Prev close $x, $y, $w, $h = 191, 122, 65, 22 $sName = %Change $iRole = 0x00000019 $sRole = column header $iState = 0x00200000 $sState = selectable $sValue = %Change $x, $y, $w, $h = 256, 122, 67, 22 $sName = Row 0 $iRole = 0x0000001C $sRole = row $iState = 0x00200000 $sState = selectable $sValue = 686.80;679.30;667.00;681.60;-1.97 $x, $y, $w, $h = 2, 144, 1368, 22 Window = 0x00050296 $sName = High Row 0 $iRole = 0x0000001D $sRole = cell $iState = 0x00300000 $sState = selectable $sValue = 686.80 $x, $y, $w, $h = 2, 144, 61, 22 $sName = Open Row 0 $iRole = 0x0000001D $sRole = cell $iState = 0x00300000 $sState = selectable $sValue = 679.30 $x, $y, $w, $h = 63, 144, 64, 22 $sName = Low Row 0 $iRole = 0x0000001D $sRole = cell $iState = 0x00300000 $sState = selectable $sValue = 667.00 $x, $y, $w, $h = 127, 144, 64, 22 $sName = Prev close Row 0 $iRole = 0x0000001D $sRole = cell $iState = 0x00300000 $sState = selectable $sValue = 681.60 $x, $y, $w, $h = 191, 144, 65, 22 $sName = %Change Row 0 $iRole = 0x0000001D $sRole = cell $iState = 0x00300000 $sState = selectable $sValue = -1.97 $x, $y, $w, $h = 256, 144, 67, 22 $sName = Row 1 $iRole = 0x0000001C $sRole = row $iState = 0x00200000 $sState = selectable $sValue = 285.00;279.55;278.10;280.45;-0.32 $x, $y, $w, $h = 2, 166, 1368, 22 Window = 0x00050296 $sName = High Row 1 $iRole = 0x0000001D $sRole = cell $iState = 0x00300000 $sState = selectable $sValue = 285.00 $x, $y, $w, $h = 2, 166, 61, 22 $sName = Open Row 1 $iRole = 0x0000001D $sRole = cell $iState = 0x00300000 $sState = selectable $sValue = 279.55 $x, $y, $w, $h = 63, 166, 64, 22 $sName = Low Row 1 $iRole = 0x0000001D $sRole = cell $iState = 0x00300000 $sState = selectable $sValue = 278.10 $x, $y, $w, $h = 127, 166, 64, 22 $sName = Prev close Row 1 $iRole = 0x0000001D $sRole = cell $iState = 0x00300000 $sState = selectable $sValue = 280.45 $x, $y, $w, $h = 191, 166, 65, 22 $sName = %Change Row 1 $iRole = 0x0000001D $sRole = cell $iState = 0x00300000 $sState = selectable $sValue = -0.32 $x, $y, $w, $h = 256, 166, 67, 22 $sName = Row 2 $iRole = 0x0000001C $sRole = row $iState = 0x00200002 $sState = selectable $sValue = 2556.00;2522.00;2492.30;2502.55;0.45 $x, $y, $w, $h = 2, 188, 1368, 22 Window = 0x00050296 $sName = High Row 2 $iRole = 0x0000001D $sRole = cell $iState = 0x00300002 $sState = selectable $sValue = 2556.00 $x, $y, $w, $h = 2, 188, 61, 22 $sName = Open Row 2 $iRole = 0x0000001D $sRole = cell $iState = 0x00300002 $sState = selectable $sValue = 2522.00 $x, $y, $w, $h = 63, 188, 64, 22 $sName = Low Row 2 $iRole = 0x0000001D $sRole = cell $iState = 0x00300002 $sState = selectable $sValue = 2492.30 $x, $y, $w, $h = 127, 188, 64, 22 $sName = Prev close Row 2 $iRole = 0x0000001D $sRole = cell $iState = 0x00300002 $sState = selectable $sValue = 2502.55 $x, $y, $w, $h = 191, 188, 65, 22 $sName = %Change Row 2 $iRole = 0x0000001D $sRole = cell $iState = 0x00300002 $sState = selectable $sValue = 0.45 $x, $y, $w, $h = 256, 188, 67, 22 $sName = Row 3 $iRole = 0x0000001C $sRole = row $iState = 0x00200000 $sState = selectable $sValue = 364.50;354.40;351.20;355.60;-0.73 $x, $y, $w, $h = 2, 210, 1368, 22 Window = 0x00050296 $sName = High Row 3 $iRole = 0x0000001D $sRole = cell $iState = 0x00300000 $sState = selectable $sValue = 364.50 $x, $y, $w, $h = 2, 210, 61, 22 $sName = Open Row 3 $iRole = 0x0000001D $sRole = cell $iState = 0x00300000 $sState = selectable $sValue = 354.40 $x, $y, $w, $h = 63, 210, 64, 22 $sName = Low Row 3 $iRole = 0x0000001D $sRole = cell $iState = 0x00300000 $sState = selectable $sValue = 351.20 $x, $y, $w, $h = 127, 210, 64, 22 $sName = Prev close Row 3 $iRole = 0x0000001D $sRole = cell $iState = 0x00300000 $sState = selectable $sValue = 355.60 $x, $y, $w, $h = 191, 210, 65, 22 $sName = %Change Row 3 $iRole = 0x0000001D $sRole = cell $iState = 0x00300000 $sState = selectable $sValue = -0.73 $x, $y, $w, $h = 256, 210, 67, 22 $sName = Row 4 $iRole = 0x0000001C $sRole = row $iState = 0x00200000 $sState = selectable $sValue = 33174.00;32312.00;32251.25;32945.70;-1.00 $x, $y, $w, $h = 2, 232, 1368, 22 Window = 0x00050296 $sName = High Row 4 $iRole = 0x0000001D $sRole = cell $iState = 0x00300000 $sState = selectable $sValue = 33174.00 $x, $y, $w, $h = 2, 232, 61, 22 $sName = Open Row 4 $iRole = 0x0000001D $sRole = cell $iState = 0x00300000 $sState = selectable $sValue = 32312.00 $x, $y, $w, $h = 63, 232, 64, 22 $sName = Low Row 4 $iRole = 0x0000001D $sRole = cell $iState = 0x00300000 $sState = selectable $sValue = 32251.25 $x, $y, $w, $h = 127, 232, 64, 22 $sName = Prev close Row 4 $iRole = 0x0000001D $sRole = cell $iState = 0x00300000 $sState = selectable $sValue = 32945.70 $x, $y, $w, $h = 191, 232, 65, 22 $sName = %Change Row 4 $iRole = 0x0000001D $sRole = cell $iState = 0x00300000 $sState = selectable $sValue = -1.00 $x, $y, $w, $h = 256, 232, 67, 22 +>20:45:12 AutoIt3.exe ended.rc:0 +>20:45:12 AutoIt3Wrapper Finished. >Exit code: 0 Time: 1.419 @LarsJ you people are expert coder so please guide should i use this code to extract information. Edited April 10, 2021 by jugador LarsJ 1 Link to comment Share on other sites More sharing options...
jugador Posted April 10, 2021 Author Share Posted April 10, 2021 (edited) @LarsJ to retrieve total number of column & Column header text Local $p_TopRWcond0 $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_HeaderControlTypeId, $p_TopRWcond0 ) If Not $p_TopRWcond0 Then Return ConsoleWrite( "$p_TopRWcond0 ERR" & @CRLF ) ConsoleWrite( "$p_TopRWcond0 OK" & @CRLF ) ; ++++++++++++++++++++++++ ConsoleWrite( "-----------------------------" & @CRLF ) Local $ptr_TopRW_Ary, $o_TopRW_Ary $o_DGridTable.FindAll( $TreeScope_Descendants, $p_TopRWcond0, $ptr_TopRW_Ary ) $o_TopRW_Ary = ObjCreateInterFace( $ptr_TopRW_Ary, $sIID_IUIAutomationElementArray, $dtagIUIAutomationElementArray ) If Not IsObj( $o_TopRW_Ary ) Then Return ConsoleWrite( "$o_TopRW_Ary ERR" & @CRLF ) ConsoleWrite( "$o_TopRW_Ary OK" & @CRLF ) ConsoleWrite( "--- No of Column ---" & @CRLF ) Local $TR_AryLength $o_TopRW_Ary.Length( $TR_AryLength ) If Not $TR_AryLength Then Return ConsoleWrite( "$TR_AryLength = 0 ERR" & @CRLF ) ConsoleWrite( "$TR_AryLength = " & $TR_AryLength & @CRLF ) ConsoleWrite( "--- Column header text ---" & @CRLF ) Local $ptr_TmpElement, $o_TmpElement, $s_TmpValue For $i = 0 To $TR_AryLength - 1 $o_TopRW_Ary.GetElement( $i, $ptr_TmpElement ) $o_TmpElement = ObjCreateInterface( $ptr_TmpElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) $o_TmpElement.GetCurrentPropertyValue( $UIA_NamePropertyId, $s_TmpValue ) ConsoleWrite( "$s_TmpValue = " & $s_TmpValue & @CRLF ) Next ; ++++++++++++++++++++++++ ----------------------------- $o_TopRW_Ary OK --- No of Column --- $TR_AryLength = 5 --- Column header text --- $s_TmpValue = High $s_TmpValue = Open $s_TmpValue = Low $s_TmpValue = Prev close $s_TmpValue = %Change Edited April 10, 2021 by jugador LarsJ 1 Link to comment Share on other sites More sharing options...
LarsJ Posted April 11, 2021 Share Posted April 11, 2021 Well done. If the MSAA code works, then you can easily use it. The problem is if the code doesn't work. Then it may well be difficult to get any help for the code. As far as I remember, the code is from 2014 and there are very few examples. I assume you've got the MSAA include through the zip files at bottom of first post in junkew's thread. And I'm pretty sure Microsoft will continue to supply the dll files with the MSAA code for many years to come. The code hasn't been updated for many years, but the old existing code will still be shipped with new versions of the Windows operating system. If you can get all your information through a combination of MSAA and UIA code, that should be OK. jugador 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...
jugador Posted April 11, 2021 Author Share Posted April 11, 2021 (edited) @LarsJ link to MSAA code & thank you 😀 for your help. Edited April 11, 2021 by jugador 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