cdeb Posted July 7, 2009 Posted July 7, 2009 I need to extract text from a Listview but I have problems. Correctly extract data such as item number, column number, etc , but do not extract the text (return ||||||||) my script: CODE$title = "WINDOW NAME" ; OK return: 0x0007043A $hListView = ControlGetHandle($title, "", "SysListView321") ConsoleWrite("$hListView " & $hListView & @CRLF) ; OK return: 4 $aInfo = _GUICtrlListView_GetColumnCount($hListView) ConsoleWrite("$aInfo " & $aInfo & @CRLF) ; OK return: 394322 $aHeader = _GUICtrlListView_GetHeader($hListView) ConsoleWrite("$aHeader " & $aHeader & @CRLF) ; ERROR return: nothing $tmp = _GUICtrlListView_GetItemText($hListView, 2, 1) ConsoleWrite("$tmp " & $tmp & @CRLF) ; OK return: 45 $Var = _GUICtrlListView_GetItemCount($hListView) ConsoleWrite("Count " & $Var & @CRLF) ; ERROR return: ; -->ListView:||| ; -->ListView:||| ; -->ListView:||| ; -->ListView:||| If $Var > 1 Then For $i = 0 To 3 ConsoleWrite("-->ListView:" & _GUICtrlListView_GetItemTextString($hListView, $i) & @CRLF) Next EndIf info: CODE >>>> Window <<<< Title: WINDOW NAME Class: TNCMDTARGETFRM__882 Position: 1464, -6 Size: 786, 525 Style: 0x96CA0000 ExStyle: 0x00000100 Handle: 0x0006032C >>>> Control <<<< Class: SysListView32 Instance: 1 ClassnameNN: SysListView321 Advanced (Class): [CLASS:SysListView32; INSTANCE:1] ID: 101 Text: Position: 10, 389 Size: 246, 77 ControlClick Coords: 121, 60 Style: 0x5020540D ExStyle: 0x00000000 Handle: 0x0007043A >>>> Mouse <<<< Position: 1598, 465 Cursor ID: 0 Color: 0xFFFFFF >>>> StatusBar <<<< >>>> Visible Text <<<< WINDOW NAME tn_sprite >>>> Hidden Text <<<<
PsaltyDS Posted July 7, 2009 Posted July 7, 2009 (edited) Perhaps you confused item number with column numbers? You have fortyfive items (0-34, 0-based) and four subitems (1 thru 4, 1-based). The way you did the loop only reads the first four items, not all four columns. Try this to see if it gets anything from the other items: If $Var > 1 Then For $i = 0 To $Var - 1 ConsoleWrite("ListView item " & $i & ": " & _GUICtrlListView_GetItemTextString($hListView, $i) & @CRLF) Next EndIf Edited July 7, 2009 by PsaltyDS 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
cdeb Posted July 7, 2009 Author Posted July 7, 2009 I know that does not control all items ... the problem is that the function GetItemTextString returns "|||||||" per line, not the text content Perhaps you confused item number with column numbers? You have fortyfive items (0-34, 0-based) and four subitems (1 thru 4, 1-based). The way you did the loop only reads the first four items, not all four columns. Try this to see if it gets anything from the other items: If $Var > 1 Then For $i = 0 To $Var - 1 ConsoleWrite("ListView item " & $i & ": " & _GUICtrlListView_GetItemTextString($hListView, $i) & @CRLF) Next EndIf
PsaltyDS Posted July 7, 2009 Posted July 7, 2009 I know that does not control all items ... the problem is that the function GetItemTextString returns "|||||||" per line, not the text contentWhat's the application that creates the ListView? It would help if we could reproduce the symptoms. 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
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