FindText - Capture screen image into text and then find it

Post a reply

Confirmation code
Enter the code exactly as it appears. All letters are case insensitive.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: FindText - Capture screen image into text and then find it

Re: FindText - Capture screen image into text and then find it

Post by Irrelephant » 08 Jul 2018, 01:23

Isn´t it enough to caputre just a part of the image - you don´t have to have the whole picture!

Increasing the the capture window shouldn´t be the problem - you just need to find the right code snippet in the script but on top you´d probably have to adjust the GUI for the fine tuning!

Re: FindText - Capture screen image into text and then find it

Post by Manlikezab12 » 07 Jul 2018, 09:59

The red box which is used to capture the image into text, can you not make it any bigger? It's a little too small for what I want to capture.

Re: FindText - Capture screen image into text and then find it

Post by feiyue » 17 Jun 2018, 15:30

@jt_kirk, It is more troublesome to generate a function to read a picture file and then convert it to two valued text.
I see you say there are not many pictures that need to be converted.
So a simple solution is to open these pictures directly,
and then use my tool to capture screen images to generate two valued text. :)

Re: FindText - Capture screen image into text and then find it

Post by jt_kirk » 10 Jun 2018, 17:52

feiyue wrote:@jt_kirk, I think this is a relatively easy solution: :)

Code: [Select all] [Expand]GeSHi © Codebox Plus




Hi, feiyue! thank you very much! Unfortunately i do not understand how this will work :( how this code will convert loaded pictures to strings?

Re: FindText - Capture screen image into text and then find it

Post by feiyue » 08 Jun 2018, 13:45

I try to use GetDCEx and BitBlt to get background windows.
Unfortunately, it failed on Win7. :headwall:

Re: FindText - Capture screen image into text and then find it

Post by feiyue » 05 Jun 2018, 05:18

guest26789 wrote:Is there a way to make it only search a certain window? (or coordinates in a window?)

WinGetPos, x, y, w, h, A
FindText(x+w//2,y+h//2,w//2,h//2,0,0,Text)

Re: FindText - Capture screen image into text and then find it

Post by Saiftey » 04 Jun 2018, 20:00

feiyue wrote:err1、err0 set 0.1 is 10%, 1 is 100%.


Ah, now that works better. Thanks lad. :bravo:

Re: FindText - Capture screen image into text and then find it

Post by guest26789 » 04 Jun 2018, 09:01

Is there a way to make it only search a certain window? (or coordinates in a window?)

Re: FindText - Capture screen image into text and then find it

Post by feiyue » 03 Jun 2018, 00:35

err1、err0 set 0.1 is 10%, 1 is 100%.

Re: FindText - Catch screen image into text and then find it

Post by Saiftey » 02 Jun 2018, 19:59

FindText(X,Y,W,H,err0,err1,Text)

err1 is the character "0" fault-tolerant in percentage (0-1) Default 0.
err0 is the character "_" fault-tolerant in percentage.(0-1) Default 0.


Please explain. I have attempted to set the err0 and err1 values to 1, 2, 3, 4, 5 and many others assuming it meant "percentage" and even just 1% makes my picture go crazy when 1% shouldn't be doing that.

How do I increase the fault tolerant? Please provide an example - I have tried replacing err1 and err0 with actual small numbers 1-9 and it just makes my script match everything black and white.

Re: FindText - Capture screen image into text and then find it

Post by guest26789 » 01 Jun 2018, 16:46

I got it to work by going back one AHK release

Re: FindText - Capture screen image into text and then find it

Post by guest26789 » 31 May 2018, 13:13

I cannot get this to run, I copied the code in the first post to a new AHK file and ran it. I get a little magnifying glass in the toolbar, but it vanishes. Help me plz :)
I am using the latest AHK 32 bit version.

Post by HBasalim » 23 May 2018, 09:42

how to show critical msgbox when more than 1 text is found within the screen?

Re: FindText - Capture screen image into text and then find it

Post by DRocks » 18 May 2018, 07:27

thats very impressive!

thank you so much :)

Re: FindText - Capture screen image into text and then find it

Post by feiyue » 18 May 2018, 05:49

@jt_kirk, I think this is a relatively easy solution: :)

Code: [Select all] [Expand]GeSHi © Codebox Plus

Re: FindText - Capture screen image into text and then find it

Post by jt_kirk » 16 May 2018, 10:24

Hi, feiyue!

Thank you for your code, it is amazing!

Is it possible to make a function (based on your code) that take as input image file, converts it to the string and then returns the string? i need to convert several small images (.PNG) files and then search for their images.

as conversion type it can use Gray2Two as it can set gray threshold automatically
as parameters it can accept offsets from image borders

Thanks in advance!

Re: FindText - Capture screen image into text and then find it

Post by Ajjervon » 02 May 2018, 21:47

I got it yay!!!!!!!
this has been edited.
Now it only works with the MsgBox uuugggghhh
Also is there a way to make it keep searching until the "text" comes up?

Re: FindText - Capture screen image into text and then find it

Post by Ajjervon » 02 May 2018, 20:45

So I got it to reload i just cant figure out how to make it click the text then write a message then hit enter. I'm still working on it any help would be loved!
Also is there a way to make it reload on its own like every 5-10seconds?

Re: FindText - Capture screen image into text and then find it

Post by Ajjervon » 02 May 2018, 20:22

Here is what I have. It only runs once i open it one time. Of course the rest of the code is there after the" ;===== Copy The Following Functions To Your Own Code Just once =====" part
I cant figure out where to put the other function codes ex: the left click and or send text code.(ex: FindText_Send_Text(Ok,"text sent",EnterKey:=1,X_Adj:=0,Y_Adj:=0,MoveBack:=0))

also once it finds the text and send my text how do i get it to do it again?
below is a copy of what i have. ant help would be great.
**********************************************************************************************************************************************
t1:=A_TickCount

Text:="|<gmail>*192$35.3k001gMk003MUk000n0DiDBa0NanPASnA6qMBaNxgEPAqPMkqNgqkSAnDhU00000E"

if (ok:=FindText(2655, 134, 150000, 150000, 0, 0, Text))
{
CoordMode, Mouse
X:=ok.1.1, Y:=ok.1.2, W:=ok.1.3, H:=ok.1.4, Comment:=ok.1.5, X+=W//2, Y+=H//2
; Click, %X%, %Y%
}

MsgBox, 4096,, % "Time:`t" (A_TickCount-t1) " ms`n`n"
. "Pos:`t" X ", " Y "`n`n"
. "Result:`t" (ok ? "Success !":"Failed !"), 3
MouseMove, X, Y


;===== Copy The Following Functions To Your Own Code Just once =====

Re: FindText - Capture screen image into text and then find it

Post by feiyue » 26 Apr 2018, 17:42

I recompiled the machine code, using the optimization option: " -O2". :xmas:

So the operation efficiency is improved. The previous was not optimized. :headwall:

Top