MikeKing Posted June 1, 2007 Share Posted June 1, 2007 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>") Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 1, 2007 Share Posted June 1, 2007 ; 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 Link to comment Share on other sites More sharing options...
MikeKing Posted June 2, 2007 Author Share Posted June 2, 2007 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now