Jump to content

Cannot check SysTreeView32 item

Recommended Posts


One of the apps I wanted to automate the installation of was Winamp, which looks like this:


The component I'm looking to control is SysTreeView32 with the id of 1032. So I used the ControlTreeView function.

Expanding the "Multimedia Engine" item (or any other item and sub-item, for that matter), works just fine with:

ControlTreeView("Winamp Installer", "Choose Components", 1032, "Expand", "#2");

Or even..

ControlTreeView("Winamp Installer", "Choose Components", 1032, "Expand", "#2|#1");

..works just fine and expands the child "Video Playback" under "Multimedia Engine" like so:


But for the life of me, I cannot get any of these items to take the Check or Uncheck command:

ControlTreeView("Winamp Installer", "Choose Components", 1032, "Uncheck", "#2|#1|#1");

which should uncheck the "Nullsoft Video (NSV)" item, but it doesn't, it merely highlights it instead for some reason.


Even Select works fine and brings the selected item to the top of the list. It's just the Check and Uncheck commands that are broken, no matter for which item. Please tell me whether I'm doing something wrong or this installer is just broken and its items cannot be checked/unchecked for some reason.

If anyone more experienced than myself has a minute to help me out, I would greatly appreciate it.

I packed the installer and my script in a .zip here   , if you want to take a look at it yourself. (I believe that's not against the rules - if it is, let me know and I'll remove it)

Thank you.

Link to post
Share on other sites
19 hours ago, anthonyjr2 said:

What are you trying to do with the last parameter? According to the helpfile it should be the item you are trying to check/uncheck.

Yes, it does represent the item I want to check/uncheck. From the docs - 'Each "level" is separated by |. An index is preceded with #.'

The problem is not choosing the item I want to control, because as I mentioned, using #2 or #2|#1 in the Expand/Select command works fine. It's just the Check/Uncheck commands that don't do what they're supposed to and just highlight the item instead (as shown above).

Edited by fw85
Link to post
Share on other sites

I've found a solution, although it requires an external UDF. For some reason the built in TreeView doesn't work correct on a lot of SysTreeView32 controls, but this other one I found does. I think it is a problem with 32/64 bit architectures. You can get the other UDF from here and then use it in your script like so:

#include "r_SysTreeView.au3"

WinWait("Installer Language", "Please select a language.");
WinActivate("Installer Language", "Please select a language.");
ControlClick("Installer Language", "Please select a language.", 1);
WinWait("Winamp Installer", "Welcome to the Winamp installer");
WinActivate("Winamp Installer", "Welcome to the Winamp installer");
ControlClick("Winamp Installer", "Welcome to the Winamp installer", 1);
WinWait("Winamp Installer", "License Agreement");
WinActivate("Winamp Installer", "License Agreement");
ControlClick("Winamp Installer", "License Agreement", 1);
WinWait("Winamp Installer", "Choose Install Location");
WinActivate("Winamp Installer", "Choose Install Location");
ControlClick("Winamp Installer", "Choose Install Location", 1);
WinWait("Winamp Installer", "Choose Components");
WinActivate("Winamp Installer", "Choose Components");
ControlCommand("Winamp Installer", "Choose Components", 1017, "SelectString", "Full");
ControlTreeView("Winamp Installer", "Choose Components", 1032, "Expand", "#2");
ControlTreeView("Winamp Installer", "Choose Components", 1032, "Expand", "#2|#1");
ControlSysTreeView("Winamp Installer", "Choose Components", "[CLASS:SysTreeView32; ID:1032]", "Uncheck", "#2|#1|#1")

I know this is an odd workaround, but hey it works for me. Also make sure you are compiling non 64-bit (I added the option at the top of my code).


Link to post
Share on other sites

Sweet, nice find!

I wasn't aware of the SysTreeView UDF at all. And since I'm using all this in a C# application in the end, I can just easily convert this as an .exe and use that there. Works like a charm now.

Much appreciated!

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...