mardi 29 décembre 2020

AHK if statment with variables not working always true

Here is what i am trying to do,

step 1 get the color of the mouse location

step 2 enter the loop

step 3 get the second color of the new mouse location

step 4 compare the two colors

error = no matter what the output of color 1 or color 2 the script below is stating true.

!^b::
MouseGetPos, MouseX, MouseY
PixelGetColor, color, %MouseX%, %MouseY%
sleep, 5000
loop
{
    MouseGetPos, MouseX, MouseY
    PixelGetColor, color2, %MouseX%, %MouseY%   
    if (%color%=%color2%)
    {
        MsgBox, it matchs %color% = %color2%
        sleep,5000
    }
    else
    {
        MsgBox, It dosnt match %color% != %color2%
        sleep, 5000
    }

}   

Aucun commentaire:

Enregistrer un commentaire