PixelSearch

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
glnklein
Posts: 116
Joined: 23 Oct 2020, 04:26

PixelSearch

07 May 2024, 08:51

PixelSearch, by default, searches from top left to top right and then goes down one line until the color is successfully found.

Is it possible to start the search from the center and search outwards in a circle
:D verwende AutoHotkey104805 :D ------------------------UPDATE auf ..1.1.33.02 erfolgreich , jetzt kommen neue Probleme :lolno:
User avatar
boiler
Posts: 17184
Joined: 21 Dec 2014, 02:44

Re: PixelSearch

07 May 2024, 13:58

glnklein wrote: PixelSearch, by default, searches from top left to top right and then goes down one line until the color is successfully found.
Actually, unlike ImageSearch, the direction of search depends on whether X1 is greater than X2 and whether Y1 is greater than Y2.

glnklein wrote: Is it possible to start the search from the center and search outwards in a circle
First, I would think you mean in an outwardly increasing rectangles, not an actual circle. It would be very difficult to make a search follow a circular pattern. And no, not unless you construct multiple searches to search in consecutive 4-segment frames that are each outside of the one prior.
User avatar
glnklein
Posts: 116
Joined: 23 Oct 2020, 04:26

Re: PixelSearch

08 May 2024, 00:43

But it is very slow, how could I improve it?

Code: Select all

-------------------------------------------------------------------------------------------------
		
		
		radius:=90
		radiusdurch3:=% Round(radius/3)  
		radiusdurch2:=% Round(radius/2)  
		radiusdurch1:=radius
		
		
		PixelSearch, Px, Py,X-radiusdurch3, Y-radiusdurch3, X+radiusdurch3, Y+radiusdurch3, suche, 6, FAST RGB
		If ErrorLevel 
		{
			PixelSearch, Px, Py,X-radiusdurch3, Y-radiusdurch2, X+radiusdurch2, Y+radiusdurch2, suche, 6, FAST RGB
			If ErrorLevel 
			{
			
				PixelSearch, Px, Py,X-radiusdurch3, Y-radiusdurch1, X+radiusdurch1, Y+radiusdurch1, suche, 6, FAST RGB
				If ErrorLevel 
				{
				
				}
		
			}
		}

	

;-------------------------------------------------------------------------------------------------
:D verwende AutoHotkey104805 :D ------------------------UPDATE auf ..1.1.33.02 erfolgreich , jetzt kommen neue Probleme :lolno:
User avatar
boiler
Posts: 17184
Joined: 21 Dec 2014, 02:44

Re: PixelSearch

08 May 2024, 02:52

You could write a function in C which would be compiled into mcode (machine code) and called by your AHK script. The function would search the memory of a bitmap that is a copy of the screen area. It would be very fast. Here is an example of an mcode function acting on a bitmap.
User avatar
glnklein
Posts: 116
Joined: 23 Oct 2020, 04:26

Re: PixelSearch

08 May 2024, 06:53

boiler wrote:
08 May 2024, 02:52
You could write a function in C which would be compiled into mcode (machine code) and called by your AHK script. The function would search the memory of a bitmap that is a copy of the screen area. It would be very fast. Here is an example of an mcode function acting on a bitmap.
looks great !
But I have no IDEA how I could use this so that a color is searched for from the middle of the screen 50px in all directions
:D verwende AutoHotkey104805 :D ------------------------UPDATE auf ..1.1.33.02 erfolgreich , jetzt kommen neue Probleme :lolno:
User avatar
boiler
Posts: 17184
Joined: 21 Dec 2014, 02:44

Re: PixelSearch

08 May 2024, 07:30

glnklein wrote: But I have no IDEA how I could use this so that a color is searched for from the middle of the screen 50px in all directions
I didn't say you would use that. I said it was an example of how you incorporate an mcode function into your hotkey script. You actually have to write the function to do what you want it to do instead.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 89 guests