Loop [PixelSearch then ImageSearch]

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Sajg
Posts: 3
Joined: 15 Sep 2017, 07:13

Loop [PixelSearch then ImageSearch]

15 Sep 2017, 07:23

Hello, i cant realize how to make it work stable. So i have code:

Code: Select all

^Del::
CoordMode, pixel,screen
CoordMode, mouse,screen
 Loop 
 {    
  PixelSearch, Px, Py, %MX%, %MY%, %MXend%, %MYend%, 0x675F2A, 3, Fast 
 if !ErrorLevel 
   {	
    MouseClick, left, %Px%, %Py%, 1, 2     	
    ImageSearch, Px, Py, %MX%, %MY%, %MXend%, %MYend%, *50 %remove1%
 if !ErrorLevel	
	{	    
    MouseClick, left, %Px%, %Py%, 1, 2
    Sleep, 200
	ImageSearch, Px, Py, %MX%, %MY%, %MXend%, %MYend%, *50 %remove2%
 if !ErrorLevel	
	   {
	   MouseClick, left, %Px%, %Py%, 1, 2
       Sleep, 500
	   } 	
 	}
	else 
	Sleep, 450 
   }
  }
It constantly searching Pixel and click it in a rectangle i selected with GUI before, then Image and click it then next Image and again click it but occasionaly.
In 50% of time it cant find 2nd image and loop breaking at PixelSearching.
Is it possible to make every step in a script being separate? Like find Pixel, stop looking for that pixel, start looking for Image1 when it found stop looking for Image1 and start looking Image2 when it found stop looking for it and start looking for Pixel?
I tried some While and goSub options. But i have serious lack of knowlege.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: MiM, ntepa, supplementfacts and 145 guests