Sign in to follow this  
Followers 0
LMenard

Accessing individual elements within a SysTreeView32 control

10 posts in this topic

Folks,

The installer I'm testing includes a window that contains a control of class SysTreeView32, which presents a list of components with checkboxes beside each.  See the attached screenshot.

I would like to be able to verify the text of each component and the status of its checkbox, but I don't seem to be able to get down to that level.  Even the AutoIt V3 Window Info tool doesn't seem to go any lower than the SysTreeView control.

Am I missing something?

Thanks.

Setup - Installer Options.png

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

I've tried:

Local $TreeViewItem0 = ControlTreeView ("         Setup: Installation Options", "Select components to install:", 1032, "Exists", "Start Menu Shortcuts")
MsgBox(0, "TreeViewItem0", "TreeViewItem0 = " & $TreeViewItem0 & ", @error = " & @error & ".", 5)

(1032) is the id of the control according to AutoIt Window Info tool.)

Result:

$TreeViewItem0 = 0, @error = 0.

So it's telling me that item "Start Menu Shortcuts" doesn't exist ($TreeViewItem0 = 0), yet @error is still 0?

Local $ItemCount = ControlTreeView ("         Setup: Installation Options", "Select components to install:", 1032, "ItemCount")

MsgBox(0, "TreeView Items", "ItemCount = " & $ItemCount & ", @error = " & @error & ".", 5)

Result:

TreeViewItems = 0, @error = 1.

I would have expected TreeViewItems should = 5.

At least now @error is saying something is wrong.  But what is it?

Edited by LMenard

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I seem to be having a similar problem with ControlListView.  I can see the number of items, but can't get their texts.

Local $ListViewItemCount = ControlListView ("MyProg Setup: Completed", "Completed", 1016, "GetItemCount")
FileWrite($hFileOpen, "Number of items in list view = """ & $ListViewItemCount & """." & @CRLF)
for $counter = 0 to $ListViewItemCount
 FileWrite($hFileOpen, "Entry " & $counter & " = " & ControlListView ("MyProg Setup: Completed", "Completed", 1016, "GetText", $counter) & @CRLF)
next

Produces:

Number of items in list view = "81".

Entry 0 =
Entry 1 =
Entry 2 =
Entry 3 =
Entry 4 =
Entry 5 =
Entry 6 =
Entry 7 =
Entry 8 =
Entry 9 =
Entry 10 =
Entry 11 =
Entry 12 =
Entry 13 =
Entry 14 =
Entry 15 =
Entry 16 =
Entry 17 =
Entry 18 =
Entry 19 =
Entry 20 =
Entry 21 =
Entry 22 =
Entry 23 =
Entry 24 =
Entry 25 =
Entry 26 =
Entry 27 =
Entry 28 =
Entry 29 =
Entry 30 =
Entry 31 =
Entry 32 =
Entry 33 =
Entry 34 =
Entry 35 =
Entry 36 =
Entry 37 =
Entry 38 =
Entry 39 =
Entry 40 =
Entry 41 =
Entry 42 =
Entry 43 =
Entry 44 =
Entry 45 =
Entry 46 =
Entry 47 =
Entry 48 =
Entry 49 =
Entry 50 =
Entry 51 =
Entry 52 =
Entry 53 =
Entry 54 =
Entry 55 =
Entry 56 =
Entry 57 =
Entry 58 =
Entry 59 =
Entry 60 =
Entry 61 =
Entry 62 =
Entry 63 =
Entry 64 =
Entry 65 =
Entry 66 =
Entry 67 =
Entry 68 =
Entry 69 =
Entry 70 =
Entry 71 =
Entry 72 =
Entry 73 =
Entry 74 =
Entry 75 =
Entry 76 =
Entry 77 =
Entry 78 =
Entry 79 =
Entry 80 =
Entry 81 =

Any ideas what I'm doing wrong?

Thanks.

Edited by Melba23
Added tags

Share this post


Link to post
Share on other sites

You're using a ListView and the OP is using a TreeView, they're not the same type of control. It would be better to open your own thread and explain what is going wrong and give us more information about the control.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I *am* the OP.

My point is that I believe I have two instances of the same problem.  Hopefully if someone can help me with one of them, it will also fix the other one.

And as for more information about the controls, I'm not the developer of the installer... I'm just a humble QA.  If there is specific information you would like about either of these controls, please let me know what it is and I will try to get it.

Thanks.

Edited by LMenard

Share this post


Link to post
Share on other sites

You could try something like this below (not tested)

Opt("WinTitleMatchMode", -2)

$hWnd = WinGetHandle("Setup")
$hTreeView = ControlGetHandle($hWnd, "", "[CLASS:SysTreeView32; INSTANCE:1]")
; test 1
$count = ControlTreeView($hWnd, "", $hTreeView, "GetItemCount")
Msgbox(0,"", $count)
; test 2
$text1 = ControlTreeView($hWnd, "", $hTreeView, "GetText", "#1")
Msgbox(0,"", $text1)
; test 3
ControlTreeView($hWnd, "", $hTreeView, "Uncheck", "#1")
; etc

 

Share this post


Link to post
Share on other sites

I'd look at the _GUICtrlListView and _GUICtrlTreeview functions to see if they would be of any help.

BTW, you don't have to be the developer of the program you're automating to know more information about the controls, there's a tool for that in AutoIt that can grab that information called AU3Info.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Mikell,

I get "5" from the GetItemCount, but nothing from the GetText.

ControlTreeView/Exists for item '#0' == 1
ControlTreeView/GetText for item '#0' ==
ControlTreeView/Exists for item '#1' == 1
ControlTreeView/GetText for item '#1' ==
ControlTreeView/Exists for item '#2' == 1
ControlTreeView/GetText for item '#2' ==
ControlTreeView/Exists for item '#3' == 1
ControlTreeView/GetText for item '#3' ==
ControlTreeView/Exists for item '#4' == 1
ControlTreeView/GetText for item '#4' ==
ControlTreeView/Exists for item '#5' == 0
ControlTreeView/GetText for item '#5' ==

BrewManNH,

I don't see any functions starting with "_" in the function reference doc , and even if I ignore the "_" I don't see "GUICtrlListView" or "GUICtrlTreeView".  Are these documented somewhere else?

I'm aware of Au3Info, I referred to it as "AutoIt Window Info tool" above.  But you still haven't told me specifically what 'more info' you'd like to see, so here is everything from the first three tabs of the AutoIt Windows Info Tool:

Basic Window Info:

Title: "Setup: Installation Options"

Class: "#32770"

Basic Control Info:

Class: SysTreeView32

Instance: 1

"Window" tab:

Title "Setup: Installation Options"

Class: "#32770"

Position: 363, 266

Size: 426, 291

Style: 0x94CA084C

Ex Style: 0x00010100

Handle: 0x0000000000020272

The "Control" tab:

Basic Window Info:

Title: "Setup: Installation Options"

Class: "#32770"

Basic Control Info:

Class: SysTreeView32

Instance: 1

ClassnameNN: SysTreeView321

Name:

Advanced Mode: [CLASS:SysTreeView32; INSTANCE:1]

ID: 1032

Text:

Position: 182, 73

Size: 227, 146

Control Click Coords: 39, 96

Style: 0x50010013

Ex Style: 0x00000204

Handle: 0x00000000000102D6

The "Visible Text" tab:

&Next >
Cancel
Nullsoft Install System v2.46
Select components to install:
Space required: 66.4MB
Check the components you want to install and uncheck the components you don't want to install. Click Next to continue.
 

Thanks, I appreciate your help.

Edited by LMenard

Share this post


Link to post
Share on other sites

I've found the problem.

Even though the application being installed is 64-bit and the OS is 64-bit, the installer they use is 32-bit (confirmed with the developer).  So compiling/running the script as x86 works.

I have one final question about something I'm still seeing, but will start a new topic for that.

Thanks for everyone's help with this.

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