Jump to content

How to controlclick an item in CLASS:SysList View32?


h711
 Share

Recommended Posts

Hi, I try to auto an installer. On one page, there is a list box with 3 items in it. How do I select one of these items?

I use AutoIt V3 Window Info to scan the box, but it can only give me infor about this box, but not the items listed in the box.

Control

Class SysListView32

Instance 1

ClassnameNN SysListView321

Advanced(Class) [CLASS:SysListView32;INSTANCE:1]

ID 1050

Test List1

Thanks for the help!

Link to comment
Share on other sites

Quick sample

#include <GuiListView.au3>

$h = WinGetHandle("[CLASS:Progman]")
$hwnd = ControlGetHandle($h,"","SysListView321")

WinActivate($h)
For $i = 0 to _GUICtrlListView_GetItemCount($hwnd) - 1
    _GUICtrlListView_SetItemSelected($hwnd,$i,True)
Next
Edited by spudw2k
Link to comment
Share on other sites

I need some help for this. I used ControlCommand to wait until the listbox finishs searching all deviceds. This part is fine. The problem is, the _GUICtrlListView_SetItemSelected did not work as I wished. For this simple test, I want the automation to select and focus on the second item in the list box. The problem is, sometime the second item is selected, some time is focused, but it's kind random. If I manually use my mouse to click one of the items, the "Next" button will be enabled. But this script never enabled the "next" button.

There must be something wrong with this code, please help me. Thanks!

Do
  Sleep(50)
Until ControlCommand("Installation Wizard", "", "[CLASS:Button; INSTANCE:10]", "IsEnabled")

$h = WinGetHandle("[CLASS:SysListView32]")
$hwnd = ControlGetHandle($h,"","SysListView321")
_GUICtrlListView_SetItemSelected($hwnd,1, true, true)
Edited by h711
Link to comment
Share on other sites

I need some help for this. I used ControlCommand to wait until the listbox finishs searching all deviceds. This part is fine. The problem is, the _GUICtrlListView_SetItemSelected did not work as I wished. For this simple test, I want the automation to select and focus on the second item in the list box. The problem is, sometime the second item is selected, some time is focused, but it's kind random. If I manually use my mouse to click one of the items, the "Next" button will be enabled. But this script never enabled the "next" button.

There must be something wrong with this code, please help me. Thanks!

Do
  Sleep(50)
Until ControlCommand("Installation Wizard", "", "[CLASS:Button; INSTANCE:10]", "IsEnabled")

$h = WinGetHandle("[CLASS:SysListView32]")
$hwnd = ControlGetHandle($h,"","SysListView321")
_GUICtrlListView_SetItemSelected($hwnd,1, true, true)
Setting the item as selected does not trigger the onclick event for it, which is what the app detects when you click on it. Try _GUICtrlListView_ClickItem() after setting the selection with _GUICtrlListView_SetItemSelected().

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • 10 months later...

Hello

There's SysListView32 and I want select item in it not by order. For example, in windows if there is an item in list called "printer" and I'm typing "pri" - the item "printer" will be selected according to this letters. How can I do this using AutoIt?

Link to comment
Share on other sites

Thanks a lot, doing such way:

$h = WinGetHandle("[CLASS:SysListView32]")
$hwnd = ControlGetHandle($h,"","SysListView321")
_GUICtrlListView_SetItemSelected($hwnd,1, true, true)   
ControlSend("Мастер установки оборудования", "", $hwnd, "{PGUP}")
ControlSend("Мастер установки оборудования", "", $hwnd, "{ASC 8079}{ASC 8160}{ASC 9128}")

for non-english captions does what I need. String has to be send in unicode.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...