JohnTWI Posted October 30, 2019 Share Posted October 30, 2019 I am trying to reference a column in my list view and if that column equals a text value (example = "CCL"), if true do something else. Thank you in advance Sample code below: Link to comment Share on other sites More sharing options...
Nine Posted October 30, 2019 Share Posted October 30, 2019 When you post code, don't provide an image, please, use this tool. It is not clear what your are asking. Do you mean if any row in a certain column contains "CCL", return True ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
JohnTWI Posted October 30, 2019 Author Share Posted October 30, 2019 50 minutes ago, Nine said: When you post code, don't provide an image, please, use this tool. It is not clear what your are asking. Do you mean if any row in a certain column contains "CCL", return True ? Yes that is what I am looking for Link to comment Share on other sites More sharing options...
Nine Posted October 30, 2019 Share Posted October 30, 2019 Well, you got 90% of the code you need in your image. If you can't figure it out, post the code as I told you and I'll show you an example of it. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
JohnTWI Posted October 30, 2019 Author Share Posted October 30, 2019 expandcollapse popup#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 More sharing options...
JohnTWI Posted October 30, 2019 Author Share Posted October 30, 2019 28 minutes ago, Nine said: Well, you got 90% of the code you need in your image. If you can't figure it out, post the code as I told you and I'll show you an example of it. Thank you Link to comment Share on other sites More sharing options...
Nine Posted October 30, 2019 Share Posted October 30, 2019 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 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
JohnTWI Posted October 30, 2019 Author Share Posted October 30, 2019 expandcollapse popup>"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 More sharing options...
Nine Posted October 30, 2019 Share Posted October 30, 2019 You mixed codes and you got bad result. Well, sorry to say, but it is not related to my code. You are on your own from here... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy 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