Jump to content

Array compare


Go to solution Solved by Geir1983,

Recommended Posts

Posted (edited)

Hello,

 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])
 EndIf 
Next
Edited by amakrkr
  • Solution
Posted

I think the PID will change for every time you start a process, how can you store a bunch of PID and know what it is?

ProcessList will return in element 0 the number of results so you should start your loop with i=1

Posted

hI,

Geir1983 thats not the problem. Problem is i need to compare strings in array 1 with every string in array 2 and display the one which is not in array2 or is in arry 2 doesnt matter.   Thanks 

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...