FindText - Capture screen image into text and then find it

Post your working scripts, libraries and tools
nwr425
Posts: 11
Joined: 08 Aug 2018, 15:41

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

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] [Download] 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] [Download] 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
}
nwr425
Posts: 11
Joined: 08 Aug 2018, 15:41

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

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 561 times
Attachments
forum post.PNG
(24.07 KiB) Not downloaded yet
Irrelephant
Posts: 5
Joined: 13 Jun 2018, 07:13

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

13 Aug 2018, 02:45

I would narrow it down to the Yes and try it again ...
feiyue
Posts: 114
Joined: 08 Aug 2014, 04:08

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

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.
NewJohn45
Posts: 2
Joined: 16 Aug 2018, 12:19

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

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] [Download] GeSHi © Codebox Plus

feiyue
Posts: 114
Joined: 08 Aug 2014, 04:08

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

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] [Download] GeSHi © Codebox Plus

bordop
Posts: 9
Joined: 03 Jun 2018, 23:03
GitHub: bordop

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

16 Aug 2018, 12:50

Just want to thank you for this incredible utility, I use it all the time!
NewJohn45
Posts: 2
Joined: 16 Aug 2018, 12:19

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

16 Aug 2018, 12:54

Thank you so much, it works amazingly fast!
bugsbunny
Posts: 2
Joined: 13 Aug 2018, 04:28

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

17 Aug 2018, 14:40

how can i make the script search only the center ?
leosouza85
Posts: 7
Joined: 22 Jul 2016, 16:28

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

09 Sep 2018, 23:31

Keep up the good work! It is awesome!
leosouza85
Posts: 7
Joined: 22 Jul 2016, 16:28

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

10 Sep 2018, 21:39

Hi, @feiyue, firstly thank you so much for your work, can I ask you something vey very simple? Could you make the script generate the code already inside a verification loop? (loop search this graphics until it finds it). I think it will help us in most use cases! Thank you!
nwr425
Posts: 11
Joined: 08 Aug 2018, 15:41

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

18 Sep 2018, 18:17

feiyue wrote:Hi

@feiyue or Anyone else.

I looked through this thread but did not find simple terms of how to complete the following:

When finding multiple identical images on a page, my end goal is to click images in the following order:
1>5
1>4
1>3
1>2
1>5
1>4
1>3
repeating/etc...

I know the normal order is top and left image first. Looking for a work around to skip images 2-4 on the first action, then 2-3, then 2, then repeat.
I can be reached on this thread of the offical AutoHotkey Discord under the name "o0PkVids"

Thanks ahead of time!
feiyue
Posts: 114
Joined: 08 Aug 2014, 04:08

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

18 Sep 2018, 20:41

Hi, @nwr425, Although this function FindText() returns all the locations found,
it is recommended to look for images that appear only once in the full screen.

1. When you write web page automation scripts,
you should try to avoid looking for multiple identical images,
try to use a unique image, to avoid unforeseen errors.
Finding another unique image and then using offset coordinates
can easily replace the coordinates of the original image.

2. If you have to use an image that appears in more than one place,
you can narrow the search area to ensure that no two original images
appear in each search area. Don't use full screen lookup.
nwr425
Posts: 11
Joined: 08 Aug 2018, 15:41

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

19 Sep 2018, 05:37

feiyue wrote:Hi, @nwr425, Although this function FindText() returns all the locations found,
it is recommended to look for images that appear only once in the full screen.

1. When you write web page automation scripts,
you should try to avoid looking for multiple identical images,
try to use a unique image, to avoid unforeseen errors.
Finding another unique image and then using offset coordinates
can easily replace the coordinates of the original image.

2. If you have to use an image that appears in more than one place,
you can narrow the search area to ensure that no two original images
appear in each search area. Don't use full screen lookup.


Any way to select which order/skip the image order?
I have 20 small identical images within close proximity to one another. Hoping to select/click images in the following order:
1>5
1>4
1>3
1>2
1>5
1>4
1>3
repeating/etc...
leosouza85
Posts: 7
Joined: 22 Jul 2016, 16:28

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

19 Sep 2018, 15:25

nwr425 wrote:
feiyue wrote:Hi, @nwr425, Although this function FindText() returns all the locations found,
it is recommended to look for images that appear only once in the full screen.

1. When you write web page automation scripts,
you should try to avoid looking for multiple identical images,
try to use a unique image, to avoid unforeseen errors.
Finding another unique image and then using offset coordinates
can easily replace the coordinates of the original image.

2. If you have to use an image that appears in more than one place,
you can narrow the search area to ensure that no two original images
appear in each search area. Don't use full screen lookup.


Any way to select which order/skip the image order?
I have 20 small identical images within close proximity to one another. Hoping to select/click images in the following order:
1>5
1>4
1>3
1>2
1>5
1>4
1>3
repeating/etc...


Those images are in order vertically or horizontally? or in random places?
nwr425
Posts: 11
Joined: 08 Aug 2018, 15:41

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

19 Sep 2018, 20:05

leosouza85 wrote:
nwr425 wrote:
feiyue wrote:Hi, @nwr425, Although this function FindText() returns all the locations found,
it is recommended to look for images that appear only once in the full screen.

1. When you write web page automation scripts,
you should try to avoid looking for multiple identical images,
try to use a unique image, to avoid unforeseen errors.
Finding another unique image and then using offset coordinates
can easily replace the coordinates of the original image.

2. If you have to use an image that appears in more than one place,
you can narrow the search area to ensure that no two original images
appear in each search area. Don't use full screen lookup.


Any way to select which order/skip the image order?
I have 20 small identical images within close proximity to one another. Hoping to select/click images in the following order:
1>5
1>4
1>3
1>2
1>5
1>4
1>3
repeating/etc...


Those images are in order vertically or horizontally? or in random places?


Visual Example:::
[1][2][3][4]
[5]repeating

Theory of working script[focused images]:::
[1]234
[5]678
--------
x[1]23
x[4]56
--------
xx[1]2
xx[3]4
-------
xxx[1]
xxx[2]
--------
[1]234
[5]678
-------
repeating
feiyue
Posts: 114
Joined: 08 Aug 2014, 04:08

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

19 Sep 2018, 20:21

@nwr425, Your description is too vague, I still don't understand what you mean.
You can upload the work picture screenshots, and then explain how to do manual work step by step.

If the position of the image remains unchanged after clicking,
you can search for the unique image next to it as the origin,
and then use the offset coordinates relative to the origin to perform the click.
nwr425
Posts: 11
Joined: 08 Aug 2018, 15:41

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

20 Sep 2018, 02:19

The numbers represent identical images that are being focused by FindText
My end goal is to:

-Click the image1 then immediately after that happens, the image1 that has been clicked will disappear.

-Then I would like to click the image that was directly below the image that previous disappeared.

-Below is an example of image [1] being clicked, and then the next Image to be clicked will be demonstrated using [brackets]

-All images that have disappeared previously will be shown using 'x'

-When 1-8 identical images are present, I would like to click the images in the order shown using brackets.

---DEFAULT BEFORE ANY CLICKS ARE SENT---
1234
5678
---------images 1 to 8 all identical-----------

---1st action/click---
[1]234
5678

--2nd action/click--
x123
[4]567

--3rd action/click---
x[1]23
x456

--4th action/click--
xx12
x[3]45

--5th action/click---
xx[1]2
xx34

--6th action/click--
xxx1
xx[2]3

--7th action/click--
xxx[1]
xxx2

--8th action/click--
xxxx
xxx[1]
nwr425
Posts: 11
Joined: 08 Aug 2018, 15:41

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

20 Sep 2018, 02:37

@feiyue

I want to put this to code using findtext. I want to select a different image other than the one in the top left slot.
Does this program order identical images in a way to do that? i.e x.1 x.2 x.3 x.4 etc etc

Hope this helps clarify! Thanks for help!
https://imgur.com/a/oXmewZy

Default:
Image

Step 1:
Image

Step 2:
Image

Step 3:
Image

Step 4:
Image

Step 5:
Image

Step 6:
Image

Step 7:
Image

Step 8:
Image
feiyue
Posts: 114
Joined: 08 Aug 2014, 04:08

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

20 Sep 2018, 13:55

@nwr425,
Although this function FindText() returns all the locations found,
because the lookup is from top to bottom,
sometimes the middle image is higher than the first image,
so it returns first, so the position returned may be disordered and difficult to sort..

I find that the location of these pictures looks unchanged,
so get the coordinates of the first image as the origin,
you could use relative coordinates to click on other images. Like this:

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


Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 22 guests