# Help with GetPixelColor(), and Comapring them

## Recommended Posts

I am trying to compare 9 different pictures each with a specific pixel i am getting from GetPixelColor(), They all have the same pixel color except for one, It can be any of the 9 pictures, so its 8 of the same color and 1 thats out of order. Anyone have a better way to figure out the colors and compare them and click the odd one out?

```Global \$1Color = PixelGetColor(399, 280)
Global \$2Color = PixelGetColor(499, 280)
Global \$3Color = PixelGetColor(599, 280)
;First
Global \$4Color = PixelGetColor(399, 380)
Global \$5Color = PixelGetColor(499, 380)
Global \$6Color = PixelGetColor(599, 380)
;Second Line
Global \$7Color = PixelGetColor(399, 480)
Global \$8Color = PixelGetColor(499, 480)
Global \$9Color = PixelGetColor(599, 480)oÝ÷ Ù«­¢+ÙÕ¹MÉ¥ÁÑ
¡¬ ¤)%ÀÌØìÅ
½±½ÈôÀÌØìÉ
½±½ÈôÀÌØìÍ
½±½ÈQ¡¸(%
¡­1¥¹QÝ¼ ¤(%±Í¥ÀÌØìÅ
½±½È±ÐìÐìÀÌØìÉ
½±½ÈôÀÌØìÍ
½±½ÈQ¡¸(\$í%¹ÍÉÐ¥ÉÍÐ  ½à
É¥µÌ°ÅÕ½ÐíÑ°ÀÀÀÌØí5¥¹A
½¹Ñ¹ÐÀÌØíÙ±
É¥µÌÀÌØíÑ¸ÄÅÕ½Ðì¤(\$%}%Ñ¥½¸ ÀÌØí½MÕµ¥Ð°ÅÕ½Ðí±¥¬ÅÕ½Ðì¤(\$%}%1½]¥Ð ÀÌØí
É¥µÌ¤(\$%}%EÕ¥Ð ÀÌØí
É¥µÌ¤(%±Í%ÀÌØìÅ
½±½ÈôÀÌØìÉ
½±½È±ÐìÐìÀÌØìÍ
½±½ÈQ¡¸(\$\$í%¹ÍÉÐQ¡¥É  ½à
É¥µÌ°ÅÕ½ÐíÑ°ÀÀÀÌØí5¥¹A
½¹Ñ¹ÐÀÌØíÙ±
É¥µÌÀÌØíÑ¸ÌÅÕ½Ðì¤(\$%}%Ñ¥½¸ ÀÌØí½MÕµ¥Ð°ÅÕ½Ðí±¥¬ÅÕ½Ðì¤(\$%}%1½]¥Ð ÀÌØí
É¥µÌ¤(\$%}%EÕ¥Ð ÀÌØí
É¥µÌ¤(%±Í%ÀÌØìÅ
½±½È±ÐìÐìÀÌØìÉ
½±½È±ÐìÐìÀÌØìÍ
½±½ÈQ¡¸(\$\$í%¹ÍÉÐM½¹    ½à
É¥µÌ°ÅÕ½ÐíÑ°ÀÀÀÌØí5¥¹A
½¹Ñ¹ÐÀÌØíÙ±
É¥µÌÀÌØíÑ¸ÈÅÕ½Ðì¤(\$%}%Ñ¥½¸ ÀÌØí½MÕµ¥Ð°ÅÕ½Ðí±¥¬ÅÕ½Ðì¤(\$%}%1½]¥Ð ÀÌØí
É¥µÌ¤(\$%}%EÕ¥Ð ÀÌØí
É¥µÌ¤(%¹%)¹Õ¹(()Õ¹
¡­1¥¹QÝ¼ ¤(%%ÀÌØìÑ
½±½ÈôÀÌØìÕ
½±½ÈôÀÌØìÙ
½±½ÈQ¡¸(\$%
¡­1¥¹Q¡É ¤(\$%±Í¥ÀÌØìÑ
½±½È±ÐìÐìÀÌØìÕ
½±½ÈôÀÌØìÙ
½±½ÈQ¡¸(\$\$í%¹ÍÉÐ½ÕÉÑ     ½à
É¥µÌ°ÅÕ½ÐíÑ°ÀÀÀÌØí5¥¹A
½¹Ñ¹ÐÀÌØíÙ±
É¥µÌÀÌØíÑ¸ÐÅÕ½Ðì¤(\$%}%Ñ¥½¸ ÀÌØí½MÕµ¥Ð°ÅÕ½Ðí±¥¬ÅÕ½Ðì¤(\$%}%1½]¥Ð ÀÌØí
É¥µÌ¤(\$%}%EÕ¥Ð ÀÌØí
É¥µÌ¤(\$%±Í¥ÀÌØìÑ
½±½ÈôÀÌØìÕ
½±½È±ÐìÐìÀÌØìÙ
½±½ÈQ¡¸(\$\$í%¹ÍÉÐM¥áÑ  ½à
É¥µÌ°ÅÕ½ÐíÑ°ÀÀÀÌØí5¥¹A
½¹Ñ¹ÐÀÌØíÙ±
É¥µÌÀÌØíÑ¸ØÅÕ½Ðì¤(\$%}%Ñ¥½¸ ÀÌØí½MÕµ¥Ð°ÅÕ½Ðí±¥¬ÅÕ½Ðì¤(\$%}%1½]¥Ð ÀÌØí
É¥µÌ¤(\$%}%EÕ¥Ð ÀÌØí
É¥µÌ¤(\$%±Í¥ÀÌØìÑ
½±½È±ÐìÐìÀÌØìÕ
½±½È±ÐìÐìÀÌØìÙ
½±½ÈQ¡¸(\$\$\$í%¹ÍÉÐ¥Ñ    ½à
É¥µÌ°ÅÕ½ÐíÑ°ÀÀÀÌØí5¥¹A
½¹Ñ¹ÐÀÌØíÙ±
É¥µÌÀÌØíÑ¸ÔÅÕ½Ðì¤(\$%}%Ñ¥½¸ ÀÌØí½MÕµ¥Ð°ÅÕ½Ðí±¥¬ÅÕ½Ðì¤(\$%}%1½]¥Ð ÀÌØí
É¥µÌ¤(\$%}%EÕ¥Ð ÀÌØí
É¥µÌ¤(%¹%)¹Õ¹()Õ¹
¡­1¥¹Q¡É ¤(%%ÀÌØìÝ
½±½ÈôÀÌØìá
½±½ÈôÀÌØìå
½±½ÈQ¡¸(\$íIÍÑÉÐMÉ¥ÁÐ(\$%}%Ñ¥½¸ ÀÌØí
É¥µÌ°ÅÕ½ÐíÑ°ÀÁ}5¥¹A
½¹Ñ¹Ñ}É±
É¥µÌ°ÅÕ½ÐíÑ°ÀÀÀÌØí5¥¹A
½¹Ñ¹ÐÀÌØíÑ¹
½µµ¥ÐÅÕ½Ðì¤(\$%}%Ñ¥½¸ ÀÌØí½MÕµ¥Ð°ÅÕ½Ðí±¥¬ÅÕ½Ðì¤(\$%}%1½]¥Ð ÀÌØí
É¥µÌ¤(\$%MÉ¥ÁÑ
¡¬ ¤(%±Í%ÀÌØìÝ
½±½È±ÐìÐìÀÌØìá
½±½ÈôÀÌØìå
½±½ÈQ¡¸(\$\$\$í%¹ÍÉÐMÙ¹Ñ     ½à
É¥µÌ°ÅÕ½ÐíÑ°ÀÀÀÌØí5¥¹A
½¹Ñ¹ÐÀÌØíÙ±
É¥µÌÀÌØíÑ¸ÜÅÕ½Ðì¤(\$%}%Ñ¥½¸ ÀÌØí½MÕµ¥Ð°ÅÕ½Ðí±¥¬ÅÕ½Ðì¤(\$%}%1½]¥Ð ÀÌØí
É¥µÌ¤(\$%}%EÕ¥Ð ÀÌØí
É¥µÌ¤(\$%±Í¥ÀÌØìÝ
½±½ÈôÀÌØìá
½±½È±ÐìÐìÀÌØìå
½±½ÈQ¡¸(\$\$í%¹ÍÉÐ9¥¹Ñ  ½à
É¥µÌ°ÅÕ½ÐíÑ°ÀÀÀÌØí5¥¹A
½¹Ñ¹ÐÀÌØíÙ±
É¥µÌÀÌØíÑ¸äÅÕ½Ðì¤(\$%}%Ñ¥½¸ ÀÌØí½MÕµ¥Ð°ÅÕ½Ðí±¥¬ÅÕ½Ðì¤(\$%}%1½]¥Ð ÀÌØí
É¥µÌ¤(\$%}%EÕ¥Ð ÀÌØí
É¥µÌ¤(\$%±Í¥ÀÌØìÝ
½±½È±ÐìÐìÀÌØìá
½±½È±ÐìÐìÀÌØìå
½±½ÈQ¡¸(\$\$\$í%¹ÍÉÐ¥¡Ñ  ½à
É¥µÌ°ÅÕ½ÐíÑ°ÀÀÀÌØí5¥¹A
½¹Ñ¹ÐÀÌØíÙ±
É¥µÌÀÌØíÑ¸àÅÕ½Ðì¤(\$%}%Ñ¥½¸ ÀÌØí½MÕµ¥Ð°ÅÕ½Ðí±¥¬ÅÕ½Ðì¤(\$%}%1½]¥Ð ÀÌØí
É¥µÌ¤(\$%}%EÕ¥Ð ÀÌØí
É¥µÌ¤(%¹%)¹Õ¹```
Edited by Regency

##### Share on other sites

you're comparing, right?

why bury yourself in scary code when you can do

something like this:

first, build this

```dim \$pixel1=whatever

\$pixel1=pixelgetcolor(x, y)
msgbox (1, "pixel", \$pixel1)```

write whatever you got from the message box on a piece of paper or something

now, build this

```\$dim const pixel1=whatever
\$dim pixel11=0

\$pixel11=pixelgetcolor(x, y)
if \$pixel11=\$pixel1 then
<insert clicking code here> endif
else
<do something else here>
endif```

except do that nine times.

i'm pretty sure that's the "retard version", but i'm confident it'll work.

##### Share on other sites

I dont think that would work for what i am trying to do...

Bump?

Bump UGH help!!

##### Share on other sites

Bump UGH help!!

I dont think that you gaved enought info. about all this,

this is how i think that all this shud looklike (dono if this is working at all, becose you did not posted anything to test it on, so i didnt try to test anything)

something like this...

```Global \$1Color = PixelGetColor(399, 280)
Global \$2Color = PixelGetColor(499, 280)
Global \$3Color = PixelGetColor(599, 280)
Global \$4Color = PixelGetColor(399, 380)
Global \$5Color = PixelGetColor(499, 380)
Global \$6Color = PixelGetColor(599, 380)
Global \$7Color = PixelGetColor(399, 480)
Global \$8Color = PixelGetColor(499, 480)
Global \$9Color = PixelGetColor(599, 480)

Select
case \$1Color = \$2Color
\$goodcolor = \$1Color
Case \$1Color <> \$2Color
\$goodcolor = \$3Color
EndSelect
If \$1Color = \$2Color = \$3Color = \$4Color = \$5Color = \$6Color = \$7Color = \$8Color = \$9Color Then
_IEAction(\$Crimes, "Back")
Else
Select
case \$1Color <> \$goodcolor
\$oSubmit=_IEGetObjByName(\$Crimes, "ctl00\$MainPageContent\$valCrimes\$btn1")
case \$2Color <> \$goodcolor
\$oSubmit=_IEGetObjByName(\$Crimes, "ctl00\$MainPageContent\$valCrimes\$btn2")
case \$3Color <> \$goodcolor
\$oSubmit=_IEGetObjByName(\$Crimes, "ctl00\$MainPageContent\$valCrimes\$btn3")
case \$4Color <> \$goodcolor
\$oSubmit=_IEGetObjByName(\$Crimes, "ctl00\$MainPageContent\$valCrimes\$btn4")
case \$5Color <> \$goodcolor
\$oSubmit=_IEGetObjByName(\$Crimes, "ctl00\$MainPageContent\$valCrimes\$btn5")
case \$6Color <> \$goodcolor
\$oSubmit=_IEGetObjByName(\$Crimes, "ctl00\$MainPageContent\$valCrimes\$btn6")
case \$7Color <> \$goodcolor
\$oSubmit=_IEGetObjByName(\$Crimes, "ctl00\$MainPageContent\$valCrimes\$btn7")
case \$8Color <> \$goodcolor
\$oSubmit=_IEGetObjByName(\$Crimes, "ctl00\$MainPageContent\$valCrimes\$btn8")
case \$9Color <> \$goodcolor
\$oSubmit=_IEGetObjByName(\$Crimes, "ctl00\$MainPageContent\$valCrimes\$btn9")
EndSelect
_IEAction(\$oSubmit, "click")
_IEQuit(\$Crimes)
EndIf```
Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)

There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

##### Share on other sites

I didn't put much thought into this... but this might work:

```;Should return an array [0] = X [1] = Y
;Should return unique pixel color found
\$aArrayCoords = _myOddOutPixelChecking()
MsgBox(64, "Info", "XCoord = " & \$aArrayCoords[0] & " | YCoord = " & \$aArrayCoords[1])

Func _myOddOutPixelChecking()
Local \$aXCoords[10] = ["", 399,499,599,399,499,599,399,499,599]
Local \$aYCoords[10] = ["", 280,280,280,380,380,380,480,480,480]
Local \$aColor[10] = ["", PixelGetColor(399, 280), _
PixelGetColor(499, 280), PixelGetColor(599, 280), _
PixelGetColor(399, 380), PixelGetColor(499, 380), _
PixelGetColor(599, 380), PixelGetColor(399, 480), _
PixelGetColor(499, 480), PixelGetColor(599, 480)]
Local \$aReturn[2], \$iCC, \$sHoldVal = \$aColor[1] & ","
For \$iCC = 2 To 9
If StringInStr("," & \$sHoldVal, "," & \$aColor[\$iCC] & ",") Then
\$sHoldVal &= \$aColor[\$iCC] & ","
Else
\$aReturn[0] = \$aXCoords[\$iCC]
\$aReturn[1] = \$aYCoords[\$iCC]
EndIf
Next
\$sHoldVal = StringSplit(StringTrimRight(\$sHoldVal, 1), ",")
If \$sHoldVal[0] > 1 Then Return \$aReturn
\$aReturn[0] = 399
\$aReturn[1] = 280
Return \$aReturn
EndFunc```

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

##### Share on other sites

~BogQ

Yours has some good idea, but doesnt work in how i want this to work..

I need to to check the pixel color and compare it between the other 2, each line has its own color code. If red as 12222 on line one it could have 44422 on line two, so it wont always see the same thing in each get color

And Smoke,

Yours just confuses me.. i dont think it does anything

##### Share on other sites

~BogQ

Yours has some good idea, but doesnt work in how i want this to work..

I need to to check the pixel color and compare it between the other 2, each line has its own color code. If red as 12222 on line one it could have 44422 on line two, so it wont always see the same thing in each get color

And Smoke,

Yours just confuses me.. i dont think it does anything

It does what I understood you wanted.

9 Pixel checks

Return the 1 that is odd out of the 9

And yes, it "does do that".

Now I took my time to do that for you... your turn .

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

##### Share on other sites

~BogQ

Yours has some good idea, but doesnt work in how i want this to work..

I need to to check the pixel color and compare it between the other 2, each line has its own color code. If red as 12222 on line one it could have 44422 on line two, so it wont always see the same thing in each get color

And Smoke,

Yours just confuses me.. i dont think it does anything

I modded it to work on all 3 X level separately like you have suggested here. I have tested it, and it does work.

It returns a 2 dimensional array.

The first dimension are the 3 loops of x coords it goes through

[0][0] = [loop 1][Xcoord Found]

[0][1] = [loop 1][Ycoord Found]

[0][2] = [loop 1][Color Found]

[1][0] = [loop 2][Xcoord Found]

[1][1] = [loop 2][Ycoord Found]

[1][2] = [loop 2][Color Found]

[2][0] = [loop 3][Xcoord Found]

[2][1] = [loop 3][Ycoord Found]

[2][2] = [loop 3][Color Found]

I didn't do an extensive test, I just quickly modded my other one... so you may have to bug proof it... and there may be an easier way... but the way you talked, I didn't feel like wasting any more brain power on simplifying it for you.

Edit:

```#include <array.au3>
\$aArrayCoords = _myOddOutPixelChecking()
_ArrayDisplay(\$aArrayCoords)
Func _myOddOutPixelChecking()
Local \$aXCoords[3] = [399,499,599]
Local \$aYCoords[3] = [280,380,480]
Local \$aRow[3][3] = [[PixelGetColor(399, 280), PixelGetColor(499, 280), PixelGetColor(599, 280)], _
[PixelGetColor(399, 380), PixelGetColor(499, 380), PixelGetColor(599, 380)], _
[PixelGetColor(399, 480), PixelGetColor(499, 480), PixelGetColor(599, 480)]]
Local \$aReturn[3][3], \$iCC
For \$iCC = 0 To 2
If (\$aRow[\$iCC][0] == \$aRow[\$iCC][1]) And (\$aRow[\$iCC][0] <> \$aRow[\$iCC][2]) Then
\$aReturn[\$iCC][0] = \$aXCoords[2]
\$aReturn[\$iCC][1] = \$aYCoords[2]
\$aReturn[\$iCC][2] = \$aRow[\$iCC][2]
ElseIf (\$aRow[\$iCC][1] == \$aRow[\$iCC][2]) And (\$aRow[\$iCC][1] <> \$aRow[\$iCC][0]) Then
\$aReturn[\$iCC][0] = \$aXCoords[0]
\$aReturn[\$iCC][1] = \$aYCoords[0]
\$aReturn[\$iCC][2] = \$aRow[\$iCC][0]
ElseIf (\$aRow[\$iCC][2] == \$aRow[\$iCC][0]) And (\$aRow[\$iCC][2] <> \$aRow[\$iCC][1]) Then
\$aReturn[\$iCC][0] = \$aXCoords[1]
\$aReturn[\$iCC][1] = \$aYCoords[1]
\$aReturn[\$iCC][2] = \$aRow[\$iCC][1]
EndIf
Next
Return \$aReturn
EndFunc```

Edit2:

Changed the function... If all the elements are blank, then it didn't find a unique color in any of the X rows.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

##### Share on other sites

Smoke the only reason i said it didnt do anything is because i have really no clue about arrays and was trying to figure out how to use it for my script and had no clue how to impliment it. Like i just spend 30 min trying to figure out exactly what happens on each line of your new code.

I am sorry if i was being snippy, I just didnt understand it. Your code prob works, but i would need some explination on how i would put the extra code i need into it, and exactly what your script does because i dont really understand arrays...

Bump

Bump

## Create an account

Register a new account