Jump to content

Get pixel Help..


Recommended Posts

I am trying ot figure out how to compair the pixels i get from the getpixelcolor()

The part i have right now gets the pixel i want them to identify...

$1Color = PixelGetColor(418,247)
$2Color = PixelGetColor(518,247)
$3Color = PixelGetColor(618,247)
;First Line
$4Color = PixelGetColor(418,347)
$5Color = PixelGetColor(518,347)
$6Color = PixelGetColor(618,347)
;Second Line
$7Color = PixelGetColor(418,447)
$8Color = PixelGetColor(518,447)
$9Color = PixelGetColor(618,447)
;Third Line

Anyone have any idea how i would compare them, like if $1Color = 8563659 and $2color = 6848650 and $3color = 8563659 i want it to click the odd color out, so in this case to click $2color, how would i make it go through and check the numbers with each other and have them get the odd one out?

Link to comment
Share on other sites

  • Moderators

If ($1Color == 8563659) Then

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.

Link to comment
Share on other sites

No, there is a chance it will have 4 different #'s, there is 4 different colors i need ot check it for, but there is one color out of sequence. So i need it to check all of the pictures for the odd one out... I was thinking about the if statement, but i need it to keep checking them, so if $1color and $2color = the same thing i need it to check $1color against $3color and so on till it is unequal

Link to comment
Share on other sites

  • Moderators

No, there is a chance it will have 4 different #'s, there is 4 different colors i need ot check it for, but there is one color out of sequence. So i need it to check all of the pictures for the odd one out... I was thinking about the if statement, but i need it to keep checking them, so if $1color and $2color = the same thing i need it to check $1color against $3color and so on till it is unequal

Guess I'm still confused on what you want if this isn't it:
Global $aX[4] = ["", 418, 518, 618]
Global $aY[4] = ["", 247, 347, 447]
Global $aColors[3]
For $i = 1 To 3
    $aColors[1] = PixelGetColor($aX[1], $aY[$i])
    $aColors[2] = PixelGetColor($aX[2], $aY[$i])
    $aColors[3] = PixelGetColor($aX[3], $aY[$i])
    If ($aColors[1] == $aColors[2]) Then
        MsgBox(64, "Info", "Color 1 equals Color 2" & @CRLF & "Loop: " & $i & @CRLF & "Y coord: " & $aY[$i])
    ElseIf ($aColors[1] == $aColors[3]) Then
        MsgBox(64, "Info", "Color 1 equals Color 3" & @CRLF & "Loop: " & $i & @CRLF & "Y coord: " & $aY[$i])
    ElseIf ($aColors[2] == $aColors[3]) Then        
        MsgBox(64, "Info", "Color 2 equals Color 3" & @CRLF & "Loop: " & $i & @CRLF & "Y coord: " & $aY[$i])
    EndIf
Next
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.

Link to comment
Share on other sites

Guess I'm still confused on what you want if this isn't it:
Global $aX[4] = ["", 418, 518, 618]
Global $aY[4] = ["", 247, 347, 447]
Global $aColors[3]
For $i = 1 To 3
    $aColors[1] = PixelGetColor($aX[1], $aY[$i])
    $aColors[2] = PixelGetColor($aX[2], $aY[$i])
    $aColors[3] = PixelGetColor($aX[3], $aY[$i])
    If ($aColors[1] == $aColors[2]) Then
        MsgBox(64, "Info", "Color 1 equals Color 2" & @CRLF & "Loop: " & $i & @CRLF & "Y coord: " & $aY[$i])
    ElseIf ($aColors[1] == $aColors[3]) Then
        MsgBox(64, "Info", "Color 1 equals Color 3" & @CRLF & "Loop: " & $i & @CRLF & "Y coord: " & $aY[$i])
    ElseIf ($aColors[2] == $aColors[3]) Then        
        MsgBox(64, "Info", "Color 2 equals Color 3" & @CRLF & "Loop: " & $i & @CRLF & "Y coord: " & $aY[$i])
    EndIf
NextoÝ÷ Ûú®¢×笲ØZ·
.Ü(®@n¶,(ºWgyçm¢Ê^Ö¥x ÛkÊ)à¶âêÞ¢ëa£h­æjwp®+^jºÚÊÂ0jËkÊ)ඬyû§rبºÞjKºØ ¹ë,×hzÉí²Ú+^¦,^Ê+²¶§KÞ¯+ax,¥w
++"¶;¬¶g¬±çn¥·q«¬z+)+b¶êbÚºw-ìjëh×6$1Color = PixelGetColor(418,247)
$2Color = PixelGetColor(518,247)
$3Color = PixelGetColor(618,247)
;First Line
$4Color = PixelGetColor(418,347)
$5Color = PixelGetColor(518,347)
$6Color = PixelGetColor(618,347)
;Second Line
$7Color = PixelGetColor(418,447)
$8Color = PixelGetColor(518,447)
$9Color = PixelGetColor(618,447)
;Third Line

If $1Color = $2Color Then ;Pass Check
    ThirdCheck()
ElseIf $1Color <> $2Color Then ; Failed Either One or Two, Checked In Next Func
    ThirdCheckUnequal()
EndIf

Func ThirdCheckUnequal()
    If $1Color <> $3Color Then ;Button One Being Odd
        $oSubmit = _IEGetObjByName($Crimes, "ctl00$MainPageContent$valCrimes$btn1")
        _IEAction($oSubmit, "click")
        _IELoadWait($Crimes)
    Elseif $2Color <> $3Color Then ;Button Two Being Odd
        $oSubmit = _IEGetObjByName($Crimes, "ctl00$MainPageContent$valCrimes$btn2")
        _IEAction($oSubmit, "click")
        _IELoadWait($Crimes)
    EndIf
Endfunc

Func ThirdCheck()
    If $1Color = $3Color Then
        FourthCheck()
    ElseIf $1Color <> $3Color Then
        $oSubmit = _IEGetObjByName($Crimes, "ctl00$MainPageContent$valCrimes$btn3")
        _IEAction($oSubmit, "click")
        _IELoadWait($Crimes)
    EndIf
EndFunc

Func FourthCheck()
    If $1Color = $4Color Then
        FifthCheck()
    ElseIf $1Color <> $4Color Then
        $oSubmit = _IEGetObjByName($Crimes, "ctl00$MainPageContent$valCrimes$btn4")
        _IEAction($oSubmit, "click")
        _IELoadWait($Crimes)
    EndIf
EndFunc

Func FifthCheck()
    If $1Color = $5Color Then
        SixthCheck()
    ElseIf $1Color <> $5Color Then
        $oSubmit = _IEGetObjByName($Crimes, "ctl00$MainPageContent$valCrimes$btn5")
        _IEAction($oSubmit, "click")
        _IELoadWait($Crimes)
    EndIf
EndFunc

Func SixthCheck()
    If $1Color = $6Color Then
        SeventhCheck()
    ElseIf $1Color <> $6Color Then
        $oSubmit = _IEGetObjByName($Crimes, "ctl00$MainPageContent$valCrimes$btn6")
        _IEAction($oSubmit, "click")
        _IELoadWait($Crimes)
    EndIf
EndFunc

Func SeventhCheck()
    If $1Color = $7Color Then
        EighthCheck()
    ElseIf $1Color <> $7Color Then
        $oSubmit = _IEGetObjByName($Crimes, "ctl00$MainPageContent$valCrimes$btn7")
        _IEAction($oSubmit, "click")
        _IELoadWait($Crimes)
    EndIf
EndFunc

Func EighthCheck()
    If $1Color = $8Color Then
        FinalCheck()
    ElseIf $1Color <> $8Color Then
        $oSubmit = _IEGetObjByName($Crimes, "ctl00$MainPageContent$valCrimes$btn8")
        _IEAction($oSubmit, "click")
        _IELoadWait($Crimes)
    EndIf
EndFunc

Func FinalCheck()
    If $1Color <> $9Color Then
        $oSubmit = _IEGetObjByName($Crimes, "ctl00$MainPageContent$valCrimes$btn9")
        _IEAction($oSubmit, "click")
        _IELoadWait($Crimes)
    EndIf
EndFunc

Any ideas on why it doesnt work?

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
 Share

  • Recently Browsing   0 members

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