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 bugsbunny » 17 Aug 2018, 14:40

how can i make the script search only the center ?

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

Post by NewJohn45 » 16 Aug 2018, 12:54

Thank you so much, it works amazingly fast!

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

Post by bordop » 16 Aug 2018, 12:50

Just want to thank you for this incredible utility, I use it all the time!

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

Post by feiyue » 16 Aug 2018, 12:43

@NewJohn45, I think you can improve in this way:
1, combinatorial search can avoid multiple screenshots.
2, narrowing the search range can significantly speed up the process.
Set 150 corresponds to a range of 301 * 301 pixels.

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

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

Post by NewJohn45 » 16 Aug 2018, 12:24

Thanks for creating such an awesome tool

It works perfectly when I try it with one image with a fast response time (70ms)

But I want to have a script that uses multiple images and now it has a 7000 response time which is far too slow, is it my poor coding? How can I make the script run fast, would it be faster to use ImageSearch for multiple images?

Here is my code. I want the script to continually loop for a long time, when it sees an image it presses the key 5

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

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

Post by feiyue » 13 Aug 2018, 23:34

@nwr425, Many positions on the web will change color when the mouse moves there. :D
So when capturing the picture, hold the right button first and then move to other places to release the right button.

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

Post by Irrelephant » 13 Aug 2018, 02:45

I would narrow it down to the Yes and try it again ...

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

Post by nwr425 » 12 Aug 2018, 15:02

Failing to find the following 'Image1' from webpage using Grey2Two and Auto. Any ideas?

Image1:
Image

Webpage View:
yes forum.PNG
yes forum.PNG (3.45 KiB) Viewed 141 times
Attachments
forum post.PNG
(24.07 KiB) Not downloaded yet

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

Post by nwr425 » 11 Aug 2018, 03:46

Big shout out to @feiyue -- Thanks for this

Curious if this theory is possible:
Image1 is currently being used to skip between different loops.

What I would like to do with Image2 is the following:
If Image2 is ever seen at any point in my script; sleep for a few seconds, navigate to a different page, then recycle my loops.

Tried something like this at the start of my script, no luck:

Code: [Select all]GeSHi © Codebox Plus

;~ if (ok:=FindText2(0,0,150000,150000,0,0,"|<blocked>*114$68.TxzzzvzzzrzHyTzzwzzztz0zbzzzDzzyTn9tyzvnzrwbwk6S3sAtkQ1y0Nb4QHAtWATVD9bmTkQwbbwnmNwbw709tzAwaT9z1k2STnC9bmTnATbbwk6A1k4lU81zA3nUy3CQ30Tnzzyzvzzrxzzs"))
;~ sleep, 180000
;~ pwb.Navigate("www.google.com") ;Navigate to URL
;~ while pwb.busy or pwb.ReadyState != 4 ;Wait for page to load
;~ Sleep, 100
;~ goto Main


Should I wrote this a different way or maybe this?

Code: [Select all]GeSHi © Codebox Plus

if (ok:=FindText2(0,0,150000,150000,0,0,"|<blocked>*114$68.TxzzzvzzzrzHyTzzwzzztz0zbzzzDzzyTn9tyzvnzrwbwk6S3sAtkQ1y0Nb4QHAtWATVD9bmTkQwbbwnmNwbw709tzAwaT9z1k2STnC9bmTnATbbwk6A1k4lU81zA3nUy3CQ30Tnzzyzvzzrxzzs"))
{
sleep, 180000
pwb.Navigate("www.google.com") ;Navigate to URL
while pwb.busy or pwb.ReadyState != 4 ;Wait for page to load
Sleep, 100
goto Main
}

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

Post by Rafaeloneil » 26 Jul 2018, 13:04

Personally, taking advantage of the subject of this topic, I ask your help in this matter:

https://stackoverflow.com/questions/515 ... ying-color

Can you help me?

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

Post by feiyue » 21 Jul 2018, 11:50

@pedroabs, I hope the following two functions can help you. :wave:

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

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

Post by pedroabs » 20 Jul 2018, 22:04

Hi feiyue,

Is this possible with your function?

1st Step: convert a 4x4 area in a screen into a text screen and stores it in a variable
2nd Step: checks that area for the captured picture and returns yes or no

My intention is to check in a regular interval if an area (an image in a game) has changed. If it changes, it returns yes and a few steps are done by my script and then recaptures the 4x4 area amd stores it in the variable for checking in the next interval.

Thank you very much in advance.

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

Post by feiyue » 20 Jul 2018, 13:45

Updated to the v5.9 version. The PicX() function is added. It is used for FindText2(). :beer:

In webpage automation tasks, I find that sometimes the text is slightly changed
(the spacing between words becomes larger), causing the FindText() function to fail.
So I added the PicX() function to divide the Text and then use the FindText2() function to find it.

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

Post by feiyue » 19 Jul 2018, 19:46

@frd, Hello! :beer:
ok:=FindText(……) If an image is found, an array will be returned. If it is not found, it will return to 0.
So you just need to compare the ok with 0. if (ok!=0) ;--> is True or False

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

Post by frd » 19 Jul 2018, 11:26

Hi people! I've been a long time lurker. AHK has made my work life so much easier, I have no words to express my gratitude towards this great community! :D :D :D

I also would like to thank Feiyue for this INCREDIBLE script! :clap: :clap: :clap: It works so well, it's pretty reliable, it's really fast.

I'm in need of a little help. Another user has asked if there's a way to retrieve a value TRUE or FALSE for this script. I need this to figure this out to solve two problems I have. I need two scripts that will do the following:

a) One that will wait one of three images to appear, if any of them appear, it will click on it and then will keep looking again, three times. If it doesnt find any of them, it will wait 2 seconds (the proprietary software I work with is extremely unstable). Then, after three loops, it will follow a routine (goto).

b) Another one that will wait for one image, if doesnt appear, wait 1 second, look for it again, wait 1 second etc endless untill it finds it, after it finds it, it will follow a routine (goto)

If someone just help me how can I get a value true or false from FINDTEXT, I believe I can slowly work my way to reach those objectives. Any help will be greatly appreciated!

Again, congratulations Feiyue for this incredible work. Hopefully it will part of the official version, since it is so much better than the built in imagesearch. Oh, I tried the code Feiyue has written in response to Cantus (23 Apr 2018, 01:47), but I couldn't manage to change it to fit my needs (I'm sorry, I'm still a newbie). Sorry!!! :( :( :(

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:

Top