PixelSearch runs even if the color is not there

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Flopz
Posts: 3
Joined: 20 Jun 2018, 10:14

PixelSearch runs even if the color is not there

20 Jun 2018, 10:25

Whenever I call this to run, it always finds the color in that part of the screen making it send the function below although it shouldn't. Not sure what I'm doing wrong here. Main goal is to have a loop going, that checks a certain part of my screen for a color, if it finds it there, it send some text into a non-active window, then runs it again whenever the color appears in that region again.

Thank you for your help.

Code: Select all

Red_1:
CoordMode, Pixel, Screen
PixelSearch, Px, Py, 23, 265, 102, 280, ffff00, 1, Fast
if ErrorLevel = 0  ; ErrorLevel is set to 0 if the colour is found
{
SendMode, Event
SetKeyDelay, 30, 30
ControlSend, , "TEST", ahk_class grcWindow
MsgBox, TEST         
}
Return
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: PixelSearch runs even if the color is not there

20 Jun 2018, 10:38

Try replacing

---> ffff00
with
---> "ffff00"
Or
---> 0xffff00
Flopz
Posts: 3
Joined: 20 Jun 2018, 10:14

Re: PixelSearch runs even if the color is not there

20 Jun 2018, 10:48

Didn't change anything I'm afraid, but thanks.
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: PixelSearch runs even if the color is not there

20 Jun 2018, 11:03

Flopz wrote:Didn't change anything I'm afraid, but thanks.
Really?

This works

Code: Select all

#SingleInstance, Force
CoordMode,Pixel,Screen
CoordMode,Mouse,Screen
Gui,1:+AlwaysOnTop -DPIScale -Caption
Gui,1:Add,Progress,x0 y0 w100 h100 Background02ffff
Random,wx,20,800
Random,wy,20,500
Gui,1:Show,x%wx% y%wy% w100 h100
SetTimer,move_it,3000
return
move_it(){	
	Random,wx,20,800
	Random,wy,20,500
	Gui,1:Show,x%wx% y%wy% w100 h100
}

numpad1::
	PixelSearch, Px, Py, 0, 0, A_ScreenWidth, A_ScreenHeight,0xffff02,0, Fast
	if(!ErrorLevel){
		MouseMove, Px+50, Py+50
	}
	else
		TrayTip,,Not Found
	return

*^ESC::ExitApp
press numpad1 to find pixel
Flopz
Posts: 3
Joined: 20 Jun 2018, 10:14

Re: PixelSearch runs even if the color is not there

20 Jun 2018, 15:27

Does, but problem is, I really can't understand why mine does not find the pixel.
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: PixelSearch runs even if the color is not there

20 Jun 2018, 15:33

just so were on the same page here, cuz i notice the name of your label(Red_1:), you are aware of the fact that youre pixelsearching for a cyan...ish, arent you? PixelSearch is BGR by default, which would put 0xFFFF00 with a variation of 1 shade, in the cyanish range.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 317 guests