Jump to content
Sign in to follow this  
Delai

Get Text From Systreeview32

Recommended Posts

Delai

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 <<<<

 

post-5223-0-09739100-1392413705_thumb.jp

post-5223-0-88058000-1392413722_thumb.jp

Share this post


Link to post
Share on other sites
LarsJ

This is easy to do with the Client UI Automation UDF.

 

; 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

Share this post


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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.