Jump to content

Array compare


Go to solution Solved by Geir1983,

Recommended Posts


 i have found quite some examples on forum but this array compare still bugs me.

What am i trying to do is, i have one array of opened processes and one array of processes listed in ini file.

I am trying to compare those two arrays and eliminate processes that are already in ini file (or in second array).

But my code instead of displaying those that are not in ini file it displays every single process because i suspect that

my code checks arrays like this:

ARRAY1: [0] PID 345   ARRAY2:[0] PID: 0  -> FALSE

ARRAY2: [1] PID 3544 ARRAY2:[1] PID: 345 -> FALSE

Above example should return only 3544.

Here is my code:

#include <Array.au3>

local $avArray[3] = ["1255","0","23423"]  
Local $aList = ProcessList("notepad.exe") 

for $i = 0 to UBound($aList,1) - 1 
 if $aList[$i][1] <> "23423" Then
     MsgBox(0,"This: ",$aList[$i][1])
Edited by amakrkr
Link to comment
Share on other sites

#include <Array.au3>

local $avArray[3] = ["1255","0","12540"]
Local $aList = ProcessList("notepad.exe")

for $i = 1 to Ubound($aList)-1
    For $j = 0 to Ubound($avArray)-1
        if $aList[$i][1] = $avArray[$j] Then $IsInArray=True
    IF $IsInArray Then MsgBox(0,"This: ",$aList[$i][1])

Like this?

Edit: to late

Edited by Geir1983
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

  • Recently Browsing   0 members

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