Sign in to follow this  
Followers 0
rusty1201

controllistview move to selected item?

2 posts in this topic

Hey guys - I've been pouring through topics on controlling a "SysListView" box and I've basically got it working, but now that I've found the item I want and have it selected I can't figure out how to actually focus it / double-click on it. Here's what I need to do:

Select an item in a list box of about 3000 items (done this)

Scroll down to where that selected item is (?)

Double-click that item

The problem is that after I select the item the box doesn't scroll itself down to the selected item, and there is no other method in the program I'm trying to automate other than double-clicking to make the selection go. If I try pressing enter or space or whatever after the item is selected by AutoIT nothing happens, I have to manually scroll down, find the item I've selected and then double-click it, which obviously isn't going to work.

Here's my code so far:

$gametype = "Yellow"
$opts = "Large"
$chnd = ControlGetHandle("Mygame", "", "SysListView322")

for $i = controllistview ("Mygame", "", "SysListView322", "GetItemCount") to 1 step -1
$txt = controllistview ("Mygame", "", "SysListView322", "GetText", $i, 2)
    if $txt = $gametype Then
        $txt = controllistview ("Mygame", "", "SysListView322", "GetText", $i, 4)
        if $txt = $opts Then
            controllistview ("Mygame", "", "SysListView322", "Select", $i)
            msgbox (0, "", "Found and selected item!")
            WinActivate ("Mygame")
            quitnow ()
        endIf
    endIf
Next

Any ideas??!

Thanks!!

Share this post


Link to post
Share on other sites



Try this:

#Include <GuiListView.au3>

$gametype = "Yellow"
$opts = "Large"
$chnd = ControlGetHandle("Mygame", "", "SysListView322")

for $i = controllistview ("Mygame", "", "SysListView322", "GetItemCount") to 1 step -1
 $txt = controllistview ("Mygame", "", "SysListView322", "GetText", $i, 2)
    if $txt = $gametype Then
        $txt = controllistview ("Mygame", "", "SysListView322", "GetText", $i, 4)
        if $txt = $opts Then
;~             controllistview ("Mygame", "", "SysListView322", "Select", $i)
        _GUICtrlListView_SetItemSelected($chnd, $i)
        _GUICtrlListView_ClickItem($chnd, $i)
            msgbox (0, "", "Found and selected item!")
            WinActivate ("Mygame")
            quitnow ()
        endIf
    endIf
Next

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