Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

ListView, Arrays, and Loops

$
0
0
So, I've been spending some time trying to build a sort of white list application properly using Arrays and some loops, but I am coming across an issue.  It works properly getting the whitelisted applications.  However, when I am listing the non-whitelisted applications they're still shown there even though it's not matching and I'm running the process 4 times (not really what I want).

This is what I have so far:  

[ autoit ]         
#include <GUIConstants.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> Global $list = ProcessList() ;List all processes Global $proc[5] = ["Explorer.exe", "Chrome.exe", "SVCHOST.exe", "Services.exe", "conhost.exe"] GUICreate("Processes", 510, 700) $run = GUICtrlCreateButton("GET PROCESSES", 10, 660, 100, 30) GUICtrlCreateLabel("Whitelisted Processes", 20, 10) $view = GUICtrlCreateListView("Process | PID", 10, 30, 230, 605, -1, $LVS_EX_CHECKBOXES) GUICtrlCreateLabel("Suspsicious Processes", 270, 10) $view2 = GUICtrlCreateListView("Process | PID", 260, 30, 230, 605, -1, $LVS_EX_CHECKBOXES) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $run Then For $o = 0 to 4 For $i = 2 To $list[0][0] Local $chk = StringInStr($list[$i][0], $proc[$o]) If $chk Then GUICtrlCreateListViewItem($list[$i][0] & "|" & $list[$i][1], $view) If $chk <> 1 Then GUICtrlCreateListViewItem($list[$i][0] & "|" & $list[$i][1], $view2) Next Next EndIf WEnd

If anyone can point out my errors... it would be much appreciated

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>