SearchForPixel Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
AkaHusky244
Posts: 2
Joined: 18 Apr 2021, 02:24

SearchForPixel

18 Apr 2021, 02:29

Hi, I have this code, and I want it to search for specific pixel(Position: 1363, 430; Color: 121212) and if it finds it to continue the loop and if it doesn't find it in 3 minutes to continue the loop.

Code: Select all

; Open AIOZ Tube
Run opera.exe "https aioz.tube "  Broken Link for safety

F1:: 
StopLoop := False 
Loop, 
{ 

       	   MouseClick, left, 1219, 158
	   sleep, 100
	   ; Reload the website
	   send(F5)
	   sleep, 5500
	   MouseClick, left, 1477, 775
	   sleep, 12500
	   ; Double Click on video for fullscreen
	   MouseClick, left, 798, 422
	   sleep, 100
	   MouseClick, left, 798, 422
	   sleep, 4000
	   ; Skip to ads
	   MouseClick, left, 1809, 1062
	   ToolTip % "Searching for pixel change - " A_Index
	   Pixelsearch,x,y, 1363, 430, 1363, 430,121212
	   if !ErrorLevel

	   

       if StopLoop 

           break 
		   

} 
return 
Esc:: 
StopLoop := True 
return
User avatar
mikeyww
Posts: 26939
Joined: 09 Sep 2014, 18:38

Re: SearchForPixel  Topic is solved

18 Apr 2021, 05:40

After the search:

Code: Select all

Sleep, 180000 * (ErrorLevel > 0)
Rohwedder
Posts: 7647
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: SearchForPixel

18 Apr 2021, 05:48

Hallo,
try:

Code: Select all

MaxTime := A_TickCount + 3*60*1000 ;3 minutes
Loop
{ ;Waiting for pixel change to 0x121212
	PixelGetColor, Color, 1363, 430
	Sleep, 50
	;ToolTip,% Color
}
Until, (Found := Color = 0x121212) Or (A_TickCount > MaxTime)
; Found = True if the color fits in time

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: NinjoOnline and 225 guests