I'm using PixelGetColor to find a color and with that result I use a loop with if else statement to perform a PixelSearch and use the coordinates to send a mouse click.
It all works fine, until the PixelGetColor result is the same as before. The PixelSearch works, but the mouse click is not being sent.
Example:
Color Result
Purple Ok
Red Ok
Purple Ok
Blue Ok
Blue Stops
Anybody knows what could be the issue?
My script:
Code: Select all
#NoEnv
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
#MaxMem 4095
ListLines Off
Process, Priority, , A
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, -1
SetControlDelay, -1
SendMode Input
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
!x::
Loop
{
Sleep 1000
PixelGetColor, Color, 1000, 530
if (Color = 0xFFA0BC) ; Purple color
{
PixelSearch, Px, Py, 750, 900, 1200, 1000, 0xD78895, 3, Fast
Px+=50
Py+=50
Send {Click, down, %Px%, %Py%}
}
else if (Color = 0x5FFFCA) ; Green color
{
PixelSearch, Px, Py, 750, 900, 1200, 1000, 0x3EE0BF, 3, Fast
Px+=50
Py+=50
Send {Click, down, %Px%, %Py%}
}
else if (Color = 0xFFE401) ; Blue color
{
PixelSearch, Px, Py, 750, 900, 1200, 1000, 0xE0C93E, 3, Fast
Px+=50
Py+=50
Send {Click, down, %Px%, %Py%}
}
else if (Color = 0x4969FF) ; Red color
{
PixelSearch, Px, Py, 750, 900, 1200, 1000, 0x2D40E1, 3, Fast
Px+=50
Py+=50
Send {Click, down, %Px%, %Py%}
}
}
Return
Esc::ExitApp