Jump to content

Recommended Posts

Posted

Hi,

I get empty values.
How to get text from a list?
Thank.

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <GuiListView.au3>

$hWin = WinGetHandle('[Title:My_arh]')
$hTC = ControlGetHandle($hWin, '', '[CLASS:SysListView32; INSTANCE:1]')

$idListview = ControlGetHandle($hWin, '', '[CLASS:SysListView32; INSTANCE:1]')

MsgBox($MB_SYSTEMMODAL, "Information", "Text:  " & _GUICtrlListView_GetItemText($idListview, 1))
MsgBox($MB_SYSTEMMODAL, "Information", "String:  " & @CRLF & @CRLF & _GUICtrlListView_GetItemTextString($idListview, 4))

 

2.png

3.png

Posted (edited)
#AutoIt3Wrapper_UseX64=Y            ; use x64 for x64 applications otherwise comment this part out
#include <GuiListView.au3>
Opt("WinTitleMatchMode", -2)        ; caselessly match any substring in the title




_GetListViewText("My_arh")






Func _GetListViewText($WindowTitle)
    Local $WinHwnd, $ControlHwnd, $Columns, $Items, $Row
    If Not WinExists($WindowTitle) Then
        Return SetError(1)
    EndIf
    While WinExists($WindowTitle)
        $WinHwnd = WinGetHandle($WindowTitle)
        If @error Then
            ContinueLoop
        EndIf
        $ControlHwnd = ControlGetHandle($WinHwnd, "", "[CLASS:SysListView32; INSTANCE:1]")
        If @error Then
            ContinueLoop
        EndIf
        $Columns = _GUICtrlListView_GetColumnCount($ControlHwnd)
        $Items = _GUICtrlListView_GetItemCount($ControlHwnd)
        ExitLoop
    WEnd
    For $Column = 0 To $Columns Step 1
        For $Index = 0 To $Items Step 1
            $Row = _GUICtrlListView_GetItemText($ControlHwnd, $Index, $Column)
            If Not $Row Then
                ContinueLoop
            EndIf
            MsgBox(0, "Results", "Column = " & $Column & @CRLF & _
                    "Index = " & $Index & @CRLF & _
                    "Text = " & $Row)
        Next
    Next
    Return 1
EndFunc   ;==>_GetListViewText

 

Edited by SirAlonne

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
  • Recently Browsing   0 members

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