Delai Posted February 14, 2014 Share Posted February 14, 2014 Hi, i have tried to get text from items in systreeview32, but without success, Here are my script and Images from a program #include <GUIConstantsEx.au3> #include <String.au3> #include <array.au3> #Include <File.au3> #include <TreeViewConstants.au3> #include <GuiTreeView.au3> $Title = "Windows Updates Downloader 2.50 Build 1002" If WinExists($Title, "") Then MsgBox(0, "", "Window exists") EndIf Local $control_hd = ControlGetHandle($Title,"","[CLASS:WindowsForms10.SysTreeView32.app.0.2331dff; INSTANCE:1]") $text = _GUICtrlTreeView_GetText ( $control_hd, "#2") MsgBox(0, "text", $text) >>>> Window <<<< Title: Windows Updates Downloader 2.50 Build 1002 Class: WindowsForms10.Window.8.app.0.2331dff Position: 326, 151 Size: 714, 425 Style: 0x16CA0000 ExStyle: 0x00050101 Handle: 0x00010756 >>>> Control <<<< Class: WindowsForms10.SysTreeView32.app.0.2331dff Instance: 1 ClassnameNN: WindowsForms10.SysTreeView32.app.0.2331dff1 Name: treeUpdates Advanced (Class): [NAME:treeUpdates] ID: 67482 Text: Position: 12, 92 Size: 684, 262 ControlClick Coords: 206, 209 Style: 0x56010A07 ExStyle: 0x00000200 Handle: 0x0001079A >>>> Mouse <<<< Position: 547, 477 Cursor ID: 2 Color: 0xFFFFFF >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< Uncheck All / Check All Proxy Settings Use Authentication Password Username 8080 Port Address Use Proxy Written by Jean-Sebastien Carle C:UsersTeAmDocumentsWindows Updates Downloader MSFN Support Forums Show Options Options Remove unlisted files Show description tooltips Show publish dates Check for updates, including beta versions Minimize to tray Product as subfolder Category as subfolder Download Folder Update List Download Change Windows 7 SP1 x64 ENU (2014-02-11) >>>> Hidden Text <<<< Link to comment Share on other sites More sharing options...
LarsJ Posted February 16, 2014 Share Posted February 16, 2014 This is easy to do with the Client UI Automation UDF. expandcollapse popup; Client UI Automation UDF #include "CUIAutomation2.au3" Opt( "MustDeclareVars", 1 ) MainFunc() Func MainFunc() ; Get window handle for Windows Updates Downloader Local $hWindow = WinGetHandle( "[REGEXPCLASS:WindowsForms10.Window.8.app.*]" ) If Not $hWindow Then Return ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) If Not IsObj( $oUIAutomation ) Then Return ; 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 ; Condition to find tree item Local $pCondition $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_TreeItemControlTypeId, $pCondition ) If Not $pCondition Then Return ; Find all tree items Local $pElementArray, $oElementArray, $iElements $oWindow.FindAll( $TreeScope_Descendants, $pCondition, $pElementArray ) $oElementArray = ObjCreateInterface( $pElementArray, $sIID_IUIAutomationElementArray, $dtagIUIAutomationElementArray ) $oElementArray.Length( $iElements ) If Not $iElements Then Return ; Print all tree item texts Local $pElement, $oElement, $sName For $i = 0 To $iElements - 1 $oElementArray.GetElement( $i, $pElement ) $oElement = ObjCreateInterface( $pElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) $oElement.GetCurrentPropertyValue( $UIA_NamePropertyId, $sName ) ConsoleWrite( $sName & @CRLF ) Next EndFunc 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...
NassauSky Posted April 10, 2020 Share Posted April 10, 2020 (edited) Hi, OK the simple first example works great to set the edit box value but how do I 'get' the value. I tried $string=$oValue.GetValue() and that didn't work. Update. Thanks @LarsJ I figured it out: $oEdit.GetCurrentPropertyValue( $UIA_ValueValuePropertyId, $sValueValue1 ) ConsoleWrite( "$sValueValue1 = " & $sValueValue1 & @CRLF ) I actually tried that before I posted but I was incorrectly using the value pattern object $oValue.GetCurrentPropertyValue( $UIA_ValueValuePropertyId, $sValueValue1 ) but it should have been $oEdit Thanks! Edited April 10, 2020 by NassauSky 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