Sign in to follow this  
Followers 0
MikeKing

ControlListView, FindItem issue

3 posts in this topic

Hi,

I'm trying to use FindItem to get the index of a string that I then want to select in a list view, but it always seems to return -1.

The commented out code in the Works section seems to work just fine. But I can't get FindItem, or GetText to work.

This is on a windows XP box, and the listview is on a form that is part of a vb script:

#Include <GuiList.au3>

Dim $cfgName

Run("C:\svn\Maestro\Source\ICP\Bin\ScicloneICP.exe")

WinWaitActive("Configuration Selection Window")

$hWnd = WinGetHandle("Configuration Selection Window", "")

; Works

;$cfgName = ControlListView($hWnd,"","ListView20WndClass1","GetItemCount", "")

;$cfgName = ControlListView($hWnd,"","ListView20WndClass1","Select",4)

;$cfgName = ControlListView($hWnd,"","ListView20WndClass1","GetSelected")

;$cfgName = ControlListView($hWnd,"","ListView20WndClass1","IsSelected", $cfgName)

; In Test

$cfgName = ControlListView($hWnd,"","ListView20WndClass1","FindItem", "Configurations\mmk",0)

;$cfgName = ControlListView($hWnd,"","ListView20WndClass1","FindItem", "Configurations\mmk")

;$cfgName = ControlListView($hWnd,"","ListView20WndClass1","FindItem", "Configurations\Sciclone Serial Number-Config gripper")

;$cfgName = ControlListView($hWnd,"","ListView20WndClass1","FindItem", "Configurations\mmk",0)

MsgBox(0, "Test", $cfgName)

;ControlClick("", "OK", 1)

ControlClick("", "Cancel", 2)

;MouseClick("left", 1125, 721)

;WinWait("Sciclone Software - <New Application>")

Share this post


Link to post
Share on other sites



; In Test

$cfgName = ControlListView($hWnd,"","ListView20WndClass1","FindItem", "Configurations\mmk",0)

From the help file:

All items/subitems are 0 based. This means that the first item/subitem in a list is 0, the second is 1, and so on.

If your 0 at the end is not meant to be "first subitem of Configurations\mnk", try just dropping it off:

$cfgName = ControlListView($hWnd,"","ListView20WndClass1","FindItem", "Configurations\mmk")

:)


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

Share this post


Link to post
Share on other sites

From the help file:

If your 0 at the end is not meant to be "first subitem of Configurations\mnk", try just dropping it off:

$cfgName = ControlListView($hWnd,"","ListView20WndClass1","FindItem", "Configurations\mmk")

:)

Ultimately I only want the first subitem, but I have tried it without the 0, and it still doesn't work.

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