Jump to content

List View reference a column


JohnTWI
 Share

Recommended Posts

Link to comment
Share on other sites

Link to comment
Share on other sites

#include <GUIListView.au3>
#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>

$hWnd = ControlGetHandle("EMR Print by Account Number","","SysListView321")
$arr = _GUICtrlListView_GetContents($hWnd)
_ArrayDisplay($arr)

Func _GUICtrlListView_GetContents($hWnd)
    $iCol = _GUICtrlListView_GetColumnCount($hWnd)
    If $iCol = 0 Then Return 0
    Dim $arrListView[1][$iCol]
    For $i = 0 to $iCol-1
        Local $Col=_GUICtrlListView_GetColumn($hWnd,$i)
        $arrListView[0][$i]=$Col[5]
    Next
    $Col = 0
    $iRows = _GUICtrlListView_GetItemCount($hWnd)
    For $i = 0 to $iRows-1

        Redim $arrListView[UBound($arrListView)+1][$iCol]
        $arrListView[UBound($arrListView)-1][0]=_GUICtrlListView_GetItemText($hWnd,$i)

        For $j = 1 To $iCol-1
            $arrListView[UBound($arrListView)-1][$j]=_GUICtrlListView_GetItemText($hWnd,$i,$j)
         Next

         Sleep(3000)
         $hListView = ControlGetHandle("EMR Print by Account Number","","SysListView321") ;Your listview handle here

         _GUICtrlListView_ClickItem($hListView,$iRows,"right",False,3)  ;iRows is getting each row in view

         Sleep(4000)
         Send("{Enter}")  ;Sends Enter

         Sleep(4000)
         Send("^{F4}")    ;sends close to window
         Sleep(3000)
         send("{down}")    ;sends down arrow
         Sleep(3000)

    Next

    $arrListView[0][0] = UBound($arrListView)-1
    _FileWriteFromArray("C:\test\tempx.txt", $arrListView)  ;write to text file
    Return $arrListView
EndFunc

 

Link to comment
Share on other sites

Untested (of course)

#include <GUIListView.au3>

$hWnd = ControlGetHandle("EMR Print by Account Number","","SysListView321")
MsgBox ($MB_SYSTEMMODAL,"",_GUICtrlListView_CheckValue($hWnd, 2, "CCL"))

Func _GUICtrlListView_CheckValue($hWnd, $iCol, $sValue)
  ;$icol is 1-based column number
  For $i = 0 To _GUICtrlListView_GetItemCount($hWnd) - 1
    If $sValue = _GUICtrlListView_GetItemText($hWnd, $i, $iCol) Then Return $i+1    ; return true (row number)
  Next
  Return 0 ; if not found return false
EndFunc   ;==>_GUICtrlListView_CheckValue

 

Link to comment
Share on other sites

>"C:\Program Files (x86)\AutoIt3\SciTE\..\au3check.exe" -q "C:\test\x.SENDTo.AutoIT.au3"
"C:\test\x.SENDTo.AutoIT.au3"(40,4) : error: missing Next.
         Func
        ~^
"C:\test\x.SENDTo.AutoIT.au3"(20,16) : REF: missing Next.
    For $i = 0 to
~~~~~~~~~~~~~~~^
"C:\test\x.SENDTo.AutoIT.au3"(40,4) : error: syntax error
         Func
        ~^
"C:\test\x.SENDTo.AutoIT.au3"(40,4) : error: Statement cannot be just an expression.
         Func
        ~^
"C:\test\x.SENDTo.AutoIT.au3"(40,58) : warning: $sValue: possibly used before declaration.
         Func _GUICtrlListView_CheckValue($hWnd, $iCol, $sValue)
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\test\x.SENDTo.AutoIT.au3"(60,5) : error: syntax error
    Next
~~~~^
"C:\test\x.SENDTo.AutoIT.au3"(60,5) : error: Statement cannot be just an expression.
    Next
~~~~^
"C:\test\x.SENDTo.AutoIT.au3"(62,45) : warning: $arrListView: possibly used before declaration.
    $arrListView[0][0] = UBound($arrListView)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\test\x.SENDTo.AutoIT.au3"(64,24) : error: 'Return' not allowed from global scope.
    Return $arrListView
~~~~~~~~~~~~~~~~~~~~~~~^
"C:\test\x.SENDTo.AutoIT.au3"(65,1) : error: syntax error
EndFunc
^
"C:\test\x.SENDTo.AutoIT.au3"(65,1) : error: Statement cannot be just an expression.
EndFunc
^
"C:\test\x.SENDTo.AutoIT.au3"(40,58) : error: $sValue: undeclared global variable.
         Func _GUICtrlListView_CheckValue($hWnd, $iCol, $sValue)
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\test\x.SENDTo.AutoIT.au3"(38,74) : error: _GUICtrlListView_CheckValue(): undefined function.
         MsgBox ($MB_SYSTEMMODAL,"",_GUICtrlListView_CheckValue($hWnd, 2, "CCL")
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\test\x.SENDTo.AutoIT.au3 - 10 error(s), 2 warning(s)
>Exit code: 2    Time: 0.356

inserted your code getting result above

Link to comment
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
 Share

  • Recently Browsing   0 members

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