[Class] graphicsearch.ahk (ImageSearch strings)

Post your working scripts, libraries and tools for AHK v1.1 and older

User avatar
boiler
Posts: 16705
Joined: 21 Dec 2014, 02:44

Re: [Class] graphicsearch.ahk (ImageSearch strings)

Post by boiler » 18 Jun 2020, 09:14

You could create a thread in the Wish List sub-forum. However, I don’t think asking lexikos to change the language will yield results based on his statements regarding his focus on v1 vs. v2. Perhaps it would be considered for v2. It certainly wouldn’t be implemented soon in any case, so I wouldn’t go that route if you’re looking for a near-term solution.

malcev
Posts: 1769
Joined: 12 Aug 2014, 12:37

Re: [Class] graphicsearch.ahk (ImageSearch strings)

Post by malcev » 18 Jun 2020, 09:23

IMHO AHK v2 if ever will be finished long time will be less popular than Ahk v1 (more complex syntax, less user libraries).
But add possibility to use pBitmap in imagesearch - it is a couple lines of code.

User avatar
Chunjee
Posts: 1397
Joined: 18 Apr 2014, 19:05
Contact:

Re: [Class] graphicsearch.ahk (ImageSearch strings)

Post by Chunjee » 23 Jun 2020, 07:46

0.3.3 is now on npm and github.

FeiYue answered my question about joinqueries/joinText which is now described in the documentation as: Whether or not to search each query in succession. Queries must be in close proximity (like characters in a string)

The code has reverted to this being defaulted to 0
I will make a tutorial on this in more detail in the future.

skripter31
Posts: 2
Joined: 20 Jun 2021, 06:56

Re: [Class] graphicsearch.ahk (ImageSearch strings)

Post by skripter31 » 20 Jun 2021, 07:03

Thanks for the script. It looks great, but I couldn't install it. Would it be possible to provide an easier installation rather than npm?

When I tried to open test-all.ahk it said Include file C:\xx\node_modules\graphicsearch.ahk\node_modules cannot be opened. The program will exit.

User avatar
Chunjee
Posts: 1397
Joined: 18 Apr 2014, 19:05
Contact:

Re: [Class] graphicsearch.ahk (ImageSearch strings)

Post by Chunjee » 21 Jun 2021, 17:03

I will update the README to read:
In your code only export.ahk needs to be included:

You may also review or copy the library from ./export.ahk on GitHub; #Incude as you would normally when manually downloading.
Hopefully this is more clear.

skripter31
Posts: 2
Joined: 20 Jun 2021, 06:56

Re: [Class] graphicsearch.ahk (ImageSearch strings)

Post by skripter31 » 28 Jun 2021, 15:50

Sorry, somehow I missed that part, my bad. I can confirm including export.ahk made it work. Excellent stuff, thanks Chunjee

User avatar
Chunjee
Posts: 1397
Joined: 18 Apr 2014, 19:05
Contact:

Re: [Class] graphicsearch.ahk (ImageSearch strings)

Post by Chunjee » 01 Aug 2021, 13:40

There is a v0.4.0 on github.

Someone was reporting an issue with a 2nd monitor. This should fix that but I wasn't able to reproduce it exactly so I'm hoping some people will test it and give the green light for better 2nd monitor support.

rc76
Posts: 144
Joined: 07 Nov 2020, 01:45

Re: [Class] graphicsearch.ahk (ImageSearch strings)

Post by rc76 » 12 Sep 2021, 22:59

Hi Guys,

I have a sort of different problem scenario would like to seek your help.

Is it possible to:
(1) Capture any type of notifications (either Yellow Warning or Pink Error) that appears on screen, for any type of contents in the notification (i.e. images are not exactly the same every time).
(2) Recognize the content of the image (i.e. text recognition or find text).

Any hint on the direction how I may achieve the above will be super appreciated. Is there any existing function can achieve it, as ImageSearch needs exact match…

Thank you so much!
Last edited by rc76 on 23 Sep 2021, 00:39, edited 1 time in total.

User avatar
Chunjee
Posts: 1397
Joined: 18 Apr 2014, 19:05
Contact:

Re: [Class] graphicsearch.ahk (ImageSearch strings)

Post by Chunjee » 14 Sep 2021, 11:51

@rc76 I think you would probably be better off with GDIP to capture the image and one of the Optical Character Recognition (OCR) packages to parse the text. I've never used those.
Another thread about trying to gather the notification text: viewtopic.php?t=76103&p=331628


graphicsearch.ahk doesn't really have much to do with understanding the text on the screen unless you painstakingly search for each word. Would be so complicated I doubt it would work well.

To answer your questions
1) yes, you can probably detect a notification
2) no, you can't recognize the content of the notification with this package

rc76
Posts: 144
Joined: 07 Nov 2020, 01:45

Re: [Class] graphicsearch.ahk (ImageSearch strings)

Post by rc76 » 15 Sep 2021, 15:55

Thank you so much @Chunjee !

neelsoon
Posts: 5
Joined: 12 Dec 2019, 17:14

Re: [Class] graphicsearch.ahk (ImageSearch strings)

Post by neelsoon » 18 Oct 2021, 15:39

I'm not very smart and I'm not able to make this work.
Is there any video tutorials?


I downloaded graphicsearch.ahk-master.zip
and extracted it, I capture a part of the screen but when I trigger the the hotkey LControl & LShift it says not found.

Code: Select all

~LControl & LShift:: ; intro 1.

; #Include graphicsearch.ahk\export.ahk
;#Include %A_ScriptDir%\graphicsearch.ahk\export.ahk
;#Include %A_ScriptDir%\export.ahk

 t1 := A_TickCount, X := Y := ""
graphicsearch_query := "|<>*183$29.ztzXtznzDsQ60sUsA1k1kM3k3Uz3w71y3yC300wQ60EssA1llkTvz3UzlwU"
 resultObj := graphicsearch.search(GraphicSearch_query)
 if (resultObj) {
   X := resultObj.1.x, Y := resultObj.1.y, Comment := resultObj.1.id
   ; Click, %X%, %Y%
 }

 MsgBox, 4096, Tip, % "Found :`t" Round(resultObj.MaxIndex())
   . "`n`nTime  :`t" (A_TickCount-t1) " ms"
   . "`n`nPos   :`t" X ", " Y
   . "`n`nResult:`t" (resultObj ? "Success !" : "Failed !")

 for i,v in resultObj
   if (i<=2)
     graphicsearch.mouseTip(resultObj[i].x, resultObj[i].y)

return


~RControl & numpad0::
Reload
Return
Anyone think can help? What I'm doing wrong?

User avatar
Chunjee
Posts: 1397
Joined: 18 Apr 2014, 19:05
Contact:

Re: [Class] graphicsearch.ahk (ImageSearch strings)

Post by Chunjee » 05 Dec 2021, 12:36

v0.4.0 has been published to npm

It was on github for a while and seems like people are having much better luck with that version.

thut11
Posts: 58
Joined: 13 Apr 2020, 14:00

Re: [Class] graphicsearch.ahk (ImageSearch strings)

Post by thut11 » 04 Nov 2022, 10:38

Chunjee wrote:
05 Dec 2021, 12:36
v0.4.0 has been published to npm

It was on github for a while and seems like people are having much better luck with that version.
I love the class but is there an easy way to create search queries from just .png or .jpg files? so i don't have to manually use the tool to capture, crop etc.?

tedo
Posts: 6
Joined: 12 Dec 2014, 13:19

Re: [Class] graphicsearch.ahk (ImageSearch strings)

Post by tedo » 05 Sep 2023, 05:35

Is there a built in tool to apply color masking to the screenshot before the library tries to find matches?

I'm guessing .scan with its screenshot argument set to zero will use whatever is on the clipboard? And if this is so, I could use other tools to apply a color mask. As long as the data on the clipboard is in bmp format it will work?

edit 9/6. I missed that this doesn't work for V2 :oops: And as such I'll stop pursuing this.

Post Reply

Return to “Scripts and Functions (v1)”