FindClick() - ImageSearch, Clicking, & More [Newest Version]

Post your working scripts, libraries and tools
Oblituarius
Posts: 6
Joined: 31 Mar 2019, 16:57

Re: FindClick() - ImageSearch, Clicking, & More [Newest Version]

06 Jan 2020, 15:00

Hi @berban It's me again.

I gave up on "db" since it never worked. I tried using the example on P.19 and I always get a blank result or "(,0). Is there a way to use that example or a variation of it to extract %Results% into an Array that I can order up? I know that if I get it to work, I could store %Coords1% and %Coords2% into some variables and then put them into an Array.
That would also work in my case.

Still testing some stuff, it's been a while since I worked on my script. I will probably have to go through FindClick.ahk to see how it is working too.

Thanks!

Edit1: So I managed to get every single instance coord with this code . Probably too much sh*t and it shouldn't be done like this. It's super messy, but it gets the job done:

Code: Select all

TableLoc()
{
	FindClick("Image", "e n Sleep500 oTransBlack,1 a408,680,-443,-329")
	Sort, Results, N R
	Coords := StrSplit(Results, "`n", "`")
	Loop % (Coords.MaxIndex()-1)
	{
		X1_Table_Array[TA1] := Coords[A_Index]
		if (X1_Table_Array[TA1] = X1_Table_Array[TA1-1])
		{
			TA1++
			TA2++
			Tooltip, Sum %TA2%, 1578, 523, 2
		}
		Sleep 800
		Temp1 := X1_Table_Array[TA1]
		Temp2 := X1_Table_Array[TA1]
		
		StartingPos := InStr(Temp1, ",")
		string1 := SubStr(Temp1, 1, 4)
		
		StartingPos := InStr(Temp2, ",")
		string2 := SubStr(Temp2, StartingPos + 1)
		
		Tooltip, %TA3%, %string1%, %string2%, %TA3%
		TA3++
		TA1++
		
		Click1 := Format("{:i}", string1)
		Click2 := Format("{:i}", string2)
		
		MouseGetPos, X, Y
		Random, I, 0, 1 ;Random ellipse invert.
		MouseMove_Ellipse(X, Y, Click1+40, Click2+60, 1, 0, I)
		
		TableFinder()
	}
	return
}
Now, for some reason, I have to leave in oTransBlack,1 or it goes bunkers xd.

This took me solid 8+hrs of research to put together. Kill me.
symaw
Posts: 1
Joined: 17 Mar 2020, 21:40

Re: FindClick() - ImageSearch, Clicking, & More [Newest Version]

17 Mar 2020, 21:50

Hello.
Does the options "Width and height to which to scale the image" works with "o – ImageSearch Options"?
I can't get it to work:
FindClick("image.jpg", "n oTransBlack,10 ow,44 oh,-1")

It will find the image.jpg at the original size, but not the scaled size.

o – ImageSearch Options
What to give comma-delimited string of imagesearch options
Description The optional parameters for ImageSearch, as shown in the AutoHotkey documentation. Use a comma to separate options instead of a space. You may omit the asterisk (*). For example: oTransBlack,20 makes black transparent and allows 20 shades of variation.

From the AutoHotkey documentation:
Options: Zero or more of the following strings may be also be present immediately before the name of the file. Separate each option from the next with a single space or tab. For example: *2 *w100 *h-1 C:\Main Logo.bmp.
*wn and *hn: Width and height to which to scale the image (this width and height also determines which icon to load from a multi-icon .ICO file). If both these options are omitted, icons loaded from ICO, DLL, or EXE files are scaled to the system's default small-icon size, which is usually 16 by 16 (you can force the actual/internal size to be used by specifying *w0 *h0). Images that are not icons are loaded at their actual size. To shrink or enlarge the image while preserving its aspect ratio, specify -1 for one of the dimensions and a positive number for the other. For example, specifying *w200 *h-1 would make the image 200 pixels wide and cause its height to be set automatically.

Thank you for reply
SmithyZoomZoom
Posts: 20
Joined: 23 Aug 2019, 23:32

Re: FindClick() - ImageSearch, Clicking, & More [Newest Version]

02 Apr 2020, 20:12

Hello:

When I downloaded Findclick, then I tried to run it, I received an error at line 143:
https://imgur.com/a/MuV7ReI
I tried creating a Lib Folder inside C:\Program Files\AutoHotkey and putting the FindClick AutoHotkey file there. It did not help.
I am unsure how to install this. Any help would be appreciated!
User avatar
Cerberus
Posts: 148
Joined: 12 Jan 2016, 15:46

Re: FindClick() - ImageSearch, Clicking, & More [Newest Version]

02 Apr 2020, 22:56

SmithyZoomZoom wrote: Hello:

When I downloaded Findclick, then I tried to run it, I received an error at line 143:
https://imgur.com/a/MuV7ReI
I tried creating a Lib Folder inside C:\Program Files\AutoHotkey and putting the FindClick AutoHotkey file there. It did not help.
I am unsure how to install this. Any help would be appreciated!
Are you sure you have downloaded the right code? Because I doubt whether there should be any code like "hydro-" in FindClick. I think you accidentally downloaded the html web page, not the Autohotkey code/script.
SmithyZoomZoom
Posts: 20
Joined: 23 Aug 2019, 23:32

Re: FindClick() - ImageSearch, Clicking, & More [Newest Version]

03 Apr 2020, 15:15

Yes. I am such a goofball. Thank you so much. If we have questions about FindClick, do we just post them in Asking for Help? I'm trying to click on a game window with a mildly transparent background. I know there's an option to allow for variations in the image, which is like the letter o and then a number: o50 for example. What's the highest amount of variation we can ask it to look for?

Edit – it's one of those situations where when you click on the object, it turns a highlighted color. I want my image search to be able to click on the highlighted and non-highlighted variations of the image. I think this is a circumstance where perhaps I have to use two images and have it search for the highlighted one if it can't find the non-highlighted one. I'm pretty sure that's possible with error levels but I'm not quite sure how.

Thank you for the help. Apologies if this is the wrong place.

Second edit –
After much trial and error, I was able to get the program to do what I needed to do – hooray! (I'm just not exactly sure how. But I think I will take that curiosity question to another thread in the forum.)

Anyway, just wanted to say thank you to @berban because, if I can get it working correctly, they use of this library will enable me to overcome a physical disability and be able to play computer games with my friends. Thanks.
nacken012
Posts: 65
Joined: 22 Jul 2016, 14:39

Re: FindClick() - ImageSearch, Clicking, & More [Newest Version]

03 Apr 2020, 21:33

Hallo

Was ich nicht verstehe, das er statt dem beige Farbton ein blauen Farbton findet

FindClick("*0xefd36b",,FoundX, FoundY)
Screenshot_5.jpg
Screenshot_5.jpg (86.11 KiB) Viewed 101 times
Da wo der linke Pfeil ist sollte er finden und finden tut er den blauen Pixel wo der rechte Pfeil ist.

Beim normalen PixelSearch macht er es richtig

PixelSearch, FoundX, FoundY, 0, 0, 1920, 1080, 0xefd36b, 0, Fast RGB

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 149 guests