FindText - Capture screen image into text and then find it

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
SteveMylo
Posts: 233
Joined: 22 Jun 2021, 00:50
Location: Australia
Contact:

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

Post by SteveMylo » 12 Dec 2021, 17:03

hmmmm, interesting. You never said what scale your 1080 screen is. mine is 100% and it has to be your Main Monitor too. Is yours? If so the script should work.
if it still doesn't work then try the Multicolor method. It's the most powerful and accurate, Replace the string with this.

Code: Select all

Text:="|<NoTick_MultiColor>##0$0/0/DDDDDD,5/0/A6A6A6,12/0/FFFFFF,19/-1/FFFFFF,26/0/FFFFFF,36/-1/FFFFFF,37/-3/FFFFFF,32/-3/FFFFFA,25/-2/1B6CCF,22/-2/FFFFFF,11/-2/A6A6A6,5/-2/DEDEDE,0/-3/A6A6A6,0/-4/A6A6A6,15/-4/FFFFFF,21/-3/FFFFFF,26/-4/FFFFFF,31/-4/DEFFFF,36/-5/FFFFFF,31/-6/8DD3F3,25/-6/FFFFFF,20/-6/FFFFFF,8/-5/DEDEDE,3/-6/DEDEDE,-1/-6/FFFFFF,0/-8/ACACAC,5/-9/EBEBEB,11/-9/B0B0B0,18/-9/FFFFFF,25/-9/236CCF,29/-9/FFFFFF,33/-9/FFFFFF,34/-9/FFFFFF,20/-11/FFFFFF,9/-11/B2B2B2,2/-11/B2B2B2,-1/-11/FFFFFF,5/-11/B2B2B2,34/-3/3BA6E8,34/-4/FFFFFF,34/-5/EFF6FA,34/-6/33A6E8,34/-7/CEF6FF,37/-7/D6FFFF,36/-7/437ADB,36/-6/F7F6FA,36/-2/437ADB,36/-3/F7F6FA,28/-6/FFFFFF,27/-5/FFFFFF,24/-8/7CC5EC,26/-3/FFF8EB,25/-5/FFFFFF,26/-6/FFFFFF,26/-7/FFFFFF,27/-8/9D83CF,26/-9/0271D2,26/-2/0271D2,23/-5/029DE5,22/-7/FFDEDB,16/-7/FFFFFF,12/-7/FFFFFF,11/-6/A6A6A6,11/-8/ACACAC"
still only takes 43ms to find. Also, it's the easiest method to change the search tolerance. Just change the 1st 0 in the string ===> ##0$ <=== to something else like 22, 44 or 66. Works great for transparency, and varying colours. for example with Youtubes SKIP ADDS, it always changes transparency with the colours behind it, Changing the tolerance works every time with the Multicolour method.

Just note,... I have given the instructions in my above replies to other people of different scales and resolutions etc.
I have many running scripts that can find images using FINDTEXT on different screens resolutions and scales.
  • All you have to do is open find text with your main monitor your using. do the search needed.
  • Then Make the 2048x1080 your main monitor, exit all programs on the computer, and reload FINDTEXT again.
  • Do the search capture again and add that text string using 'AllAdd' button underneath Your 1st 1920x1080 code you captured.
  • Just capture as many resolutions and scales as you can. If it means capturing 25 images then do it. FIND TEXT is still pretty fast.
  • If you change scale to 125%, then repeat the WHOLE process again. Close EVERYTHING and reload and redo
I"m trying to build a script where it detects the user's Screen resolutions and scales and loads the appropriate script so the FINDTEXT function doesn't have to search all resolutions. But I have no idea how haha

chaoscreater
Posts: 60
Joined: 12 Sep 2019, 21:15

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

Post by chaoscreater » 13 Dec 2021, 17:52

SteveMylo wrote:
12 Dec 2021, 17:03
hmmmm, interesting. You never said what scale your 1080 screen is. mine is 100% and it has to be your Main Monitor too. Is yours? If so the script should work.
if it still doesn't work then try the Multicolor method. It's the most powerful and accurate, Replace the string with this.

Code: Select all

Text:="|<NoTick_MultiColor>##0$0/0/DDDDDD,5/0/A6A6A6,12/0/FFFFFF,19/-1/FFFFFF,26/0/FFFFFF,36/-1/FFFFFF,37/-3/FFFFFF,32/-3/FFFFFA,25/-2/1B6CCF,22/-2/FFFFFF,11/-2/A6A6A6,5/-2/DEDEDE,0/-3/A6A6A6,0/-4/A6A6A6,15/-4/FFFFFF,21/-3/FFFFFF,26/-4/FFFFFF,31/-4/DEFFFF,36/-5/FFFFFF,31/-6/8DD3F3,25/-6/FFFFFF,20/-6/FFFFFF,8/-5/DEDEDE,3/-6/DEDEDE,-1/-6/FFFFFF,0/-8/ACACAC,5/-9/EBEBEB,11/-9/B0B0B0,18/-9/FFFFFF,25/-9/236CCF,29/-9/FFFFFF,33/-9/FFFFFF,34/-9/FFFFFF,20/-11/FFFFFF,9/-11/B2B2B2,2/-11/B2B2B2,-1/-11/FFFFFF,5/-11/B2B2B2,34/-3/3BA6E8,34/-4/FFFFFF,34/-5/EFF6FA,34/-6/33A6E8,34/-7/CEF6FF,37/-7/D6FFFF,36/-7/437ADB,36/-6/F7F6FA,36/-2/437ADB,36/-3/F7F6FA,28/-6/FFFFFF,27/-5/FFFFFF,24/-8/7CC5EC,26/-3/FFF8EB,25/-5/FFFFFF,26/-6/FFFFFF,26/-7/FFFFFF,27/-8/9D83CF,26/-9/0271D2,26/-2/0271D2,23/-5/029DE5,22/-7/FFDEDB,16/-7/FFFFFF,12/-7/FFFFFF,11/-6/A6A6A6,11/-8/ACACAC"
still only takes 43ms to find. Also, it's the easiest method to change the search tolerance. Just change the 1st 0 in the string ===> ##0$ <=== to something else like 22, 44 or 66. Works great for transparency, and varying colours. for example with Youtubes SKIP ADDS, it always changes transparency with the colours behind it, Changing the tolerance works every time with the Multicolour method.

Just note,... I have given the instructions in my above replies to other people of different scales and resolutions etc.
I have many running scripts that can find images using FINDTEXT on different screens resolutions and scales.
  • All you have to do is open find text with your main monitor your using. do the search needed.
  • Then Make the 2048x1080 your main monitor, exit all programs on the computer, and reload FINDTEXT again.
  • Do the search capture again and add that text string using 'AllAdd' button underneath Your 1st 1920x1080 code you captured.
  • Just capture as many resolutions and scales as you can. If it means capturing 25 images then do it. FIND TEXT is still pretty fast.
  • If you change scale to 125%, then repeat the WHOLE process again. Close EVERYTHING and reload and redo
I"m trying to build a script where it detects the user's Screen resolutions and scales and loads the appropriate script so the FINDTEXT function doesn't have to search all resolutions. But I have no idea how haha
I'm always using 100% scaling for all my monitors. Each of my monitors use different screen resolutions. However, the script I'm trying to create is not just for myself, it is for others as well. I need to account for the various screen resolutions and scaling other people might use. If someone has a monitor that supports 4k and mine does not, then I won't be able to make the script work for that person. I'm also not going to go out and buy a 4k monitor just to make this work either.

Also, assuming I were to capture 20+ images for the different screen resolution + screen scaling, then that's a pretty inefficient and bad way of solving this issue. If I have 100 different images to capture and each require 20 images (for the different resolution + scaling), then that is 2000 captures. That is a waste of time.

Anyway, let's ignore the screen resolution + scaling discussion for now. The main issue that you're not understanding is that FindText is detecting the Contact tickbox, even though the captured image is for the CC tickbox.

Take a look closely at the screenshot below. See how there's a blue rectangle around the Contact tickbox? It means that when I clicked "Test" in FindText, it successfully "found" the image. The image found is incorrect. It should only find an unticked CC tickbox, not an unticked Contact tickbox.

Image


Just to emphasize the issue and the goal here:

- I only care about the CC tickbox.
- When CC tickbox is unticked, FindText will successfully find the CC tickbox image - good.
- When CC tickbox is ticked, FindText should fail. However, it "successfully" found the Contact tickbox image - which is the wrong image to find.
- GetRange cannot be used to limit the search range to a particular spot - because the image could appear anywhere on the screen.

User avatar
SteveMylo
Posts: 233
Joined: 22 Jun 2021, 00:50
Location: Australia
Contact:

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

Post by SteveMylo » 13 Dec 2021, 19:53

Gotchya, Yeah I went out and bought 4k, 2k and a couple more cheap monitors just to do the extra scripts for different monitors. It's worth it for me but I certainly don't have that many scripts to write as you do ha. So I get ya. Someone in this forum posted about using actual images and using a scale equation to fix an issue like you have. But I don't know much more than that.

Also try this TEXT string on your image, works for me.

Code: Select all

Text:="|<>##0$0/0/C0C0C0,9/0/C0C0C0,-1/11/DDDDDD,10/11/DDDDDD,9/10/C7C7C7,10/7/A6A6A6,10/5/A6A6A6,-1/5/A6A6A6,1/4/DEDEDE,4/4/DEDEDE,7/4/DEDEDE,4/6/DEDEDE,1/6/DEDEDE,4/10/DEDEDE,3/9/DEDEDE,1/8/DEDEDE,6/6/DEDEDE,2/4/DEDEDE,6/3/E5E5E5,3/2/EBEBEB,3/1/EDEDED,6/1/EDEDED,8/1/EDEDED,6/0/B2B2B2,1/0/B2B2B2,2/0/B2B2B2,8/0/B2B2B2,16/5/FFFFFF,20/5/FFFFFF,22/5/029DE5,22/4/4383DD,23/2/958AD1,26/2/74B7E9,27/3/7CC9F7,38/4/FFFFFF,35/4/437ADB,33/4/CEF6FF,32/4/2B86DA,30/4/747CCF,30/5/8DD3F3,33/5/33A6E8,36/5/FFFFFF,39/5/FFFFFF,44/6/FFFFFF,48/5/FFFFFF,41/4/FFFFFF,45/4/FFFFFF,55/5/FFFFFF,59/4/FFFFFF,60/5/FFFFFF,38/11/FFFFFF,37/9/FFFFFF,46/9/FFFFFF,52/8/FFFFFF,59/8/FFFFFF,60/7/FFFFFF,46/6/FFFFFF,39/7/FFFFFF,36/7/FFFFFF,30/7/DEFFFF,26/7/F7D7DE,23/7/E7FFFF,23/4/E7FFFF,38/5/FFFFFF,39/4/FFFFFF,24/9/1B6CCF,31/9/026CCF,40/9/FFFFFF,53/8/FFFFFF,60/8/FFFFFF,14/1/FFFFFF,14/8/FFFFFF,5/7/DEDEDE,2/5/DEDEDE,18/12/FFFFFF,26/11/FFFFFF,34/10/FFFFFF,35/8/F7F6FA,24/5/FFFFFF,27/2/F7FFFF,37/3/FFFFFF,42/3/FFFFFF,12/1/FFFFFF"
 if (ok:=FindText(0, 0, 0, 0, 0, 0, Text))  ; all 0's in range means search entire screen. At least in the new Version.
 {
   CoordMode, Mouse
   X:=ok.1.x, Y:=ok.1.y, Comment:=ok.1.id
   	X := X-27
	Y := Y + 0
   Click, %X%, %Y%
 }
return

chaoscreater
Posts: 60
Joined: 12 Sep 2019, 21:15

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

Post by chaoscreater » 13 Dec 2021, 20:11

I've just tested your code against the screenshots I've shared in the previous page and it works, awesome!

Unfortunately, the code doesn't work for the actual app I'm using. I'm guessing that when I took a screenshot, it probably shows a slightly different background compared to the actual app itself...

I've tried using Multicolor myself, but FindText always seem to detect the Contact tickbox when the CC tickbox is ticked, which I do not want. How did you generate your captured image?

UPDATE:

Actually, I just tried Multicolor again and selected a lot more of the squares for the captured image and it's working now. I've done this before and couldn't get it to work properly, but somehow it works now so happy with that. Now just need to figure out a solution for the screen resolution + scaling issue. Thanks for your help.
Last edited by chaoscreater on 21 Dec 2021, 18:54, edited 2 times in total.

User avatar
SteveMylo
Posts: 233
Joined: 22 Jun 2021, 00:50
Location: Australia
Contact:

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

Post by SteveMylo » 13 Dec 2021, 20:15

I thought that might be the case. Try Multicolor again but just click absolutely everywhere, make it a long ass text string. It really should work and kind of impossible for it not to work. Click on every pixel if you have too heh heh
Oh and make sure you tick the tick box under the multicolour section before using it. I'm sure you did. It's a bit weird that you have to check the tick box I always thought

chaoscreater
Posts: 60
Joined: 12 Sep 2019, 21:15

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

Post by chaoscreater » 21 Dec 2021, 18:54

Just continuing from the discussions in the posts above, I just want to share a workaround for the issue that I was having.

Just to re-iterate the issue - the script I'm trying to make is not just for myself. It is for multiple people. I need to make sure that FindText will be able to scan/find the image, regardless of the screen resolution, scaling, or how many monitors that someone is using. I need to also account for performance as well.

For example, let's say I have 7 monitors. If I use something like this:

Code: Select all

if (ok:=FindText(0, 0, 0, 0, 0, 0, Some_Image_To_Scan))
Then it'll take longer to run than if I were to do something like this:

Code: Select all

if ((ok:=FindText(1, 2, 3, 4, 0, 0, Some_Image_To_Scan)) || (ok:=FindText(5, 6, 7, 8, 0, 0, Some_Image_To_Scan)) || (ok:=FindText(9, 10, 11, 12, 0, 0, Some_Image_To_Scan)) || (ok:=FindText(13, 14, 15, 16, 0, 0, Some_Image_To_Scan)) || (ok:=FindText(17, 18, 19, 20, 0, 0, Some_Image_To_Scan)) || (ok:=FindText(21, 22, 23, 24, 0, 0, Some_Image_To_Scan)) || (ok:=FindText(25, 26, 27, 28, 0, 0, Some_Image_To_Scan)))
I know the X1,Y1 and X2,Y2 coordinates don't make sense, but you get the idea. It's much faster to use specific scanning ranges for FindText, in order to quickly locate the image you're trying to scan. The bigger monitor or the higher the resolution, the more areas that FindText needs to scan and the slower the performance.

Now, the image I'm trying to scan is from a specific software. The software can be moved to any of my monitors, each with different screen resolution. If the program is on monitor 1, then it wouldn't make sense to use FindText(0,0,0,0,0,0...), because that will scan ALL monitors. It would make more sense to just scan on monitor 1. So, here's my workaround:

In your main code, add the following function and define the X1, Y1 and X2,Y2 co-ordinates that are specific to each monitor. You can get the values by just using GetRange in FindText and select a specific range that you want to scan for. You can get blahX and blahY by looking at "Active Window Position" in WindowsSpy (right click on Autohotkey icon in your traybar to run it).

Code: Select all

GetAppMonitorPosition:
{
	WinGetPos, blahX, blahY, blahW, blahH, A
	;MsgBox, Connectwise is at %blahX%`,%blahY% and its size is %blahW%x%blahH%	
	
	; Home Dell monitor
	if (blahX = -8 && blahY = -1088)
	{
		Global X1Start := 5
		Global Y1Start := -980
		Global X2Start := 1153
		Global Y2Start := -420
		
		
	}
	
	
	; HP Probook 445 G7  work laptop itself
	if (blahX = -8 && blahY = -8)
	{
		Global X1Start := 0
		Global Y1Start := 0
		Global X2Start := 886
		Global Y2Start := 676
		
		
	}
	
	; Home Asus monitor
	if (blahX = -1928 && blahY = -1089)
	{
		Global X1Start := -1919
		Global Y1Start := -1080
		Global X2Start := -1085
		Global Y2Start := -406
	}
	


	return
}

Then, just before your FindText code runs, just do this:

Code: Select all

Gosub, GetAppMonitorPosition
And finally, update your FindText code to this:

Code: Select all

Some_Image_To_Scan:="|<>*186$44.y00000000000000G01s000CU0n0007c08HY03m021A00sU0UE00A808I003203BA00UU0SCE008000003w000000U"
if (ok:=FindText(X1Start, Y1Start, X2Start, Y2Start, 0, 0, Some_Image_To_Scan))
So basically, depending on which monitor the program is running on, it will only scan using co-ordinates specific to that monitor, which makes performance so much better.

User avatar
SteveMylo
Posts: 233
Joined: 22 Jun 2021, 00:50
Location: Australia
Contact:

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

Post by SteveMylo » 21 Dec 2021, 19:24

chaoscreater wrote:
21 Dec 2021, 18:54
Just continuing from the discussions in the posts above

Incredible. Can't wait to try it!
I just quickly did a WinGetPos on my Program and it didn't work cause it was running in Fullscreen Mode.
So I had to add DetectHiddenWindows, On before it (see code below) FYI.

EDIT** I deleted a section here. Just Ignore if you already read that part

Code: Select all

z::
DetectHiddenWindows, On
WinGetPos, blahX, blahY, blahW, blahH, A
MsgBox, Connectwise is at %blahX%`,%blahY% and its size is %blahW%x%blahH%	

return

User avatar
SteveMylo
Posts: 233
Joined: 22 Jun 2021, 00:50
Location: Australia
Contact:

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

Post by SteveMylo » 22 Dec 2021, 16:56

chaoscreater wrote:
21 Dec 2021, 18:54
For example, let's say I have 7 monitors. If I use something like this:
EDITED***
Thought I would share my loop script. You gave me the idea of separating the search ranges.
It's super interesting to see :shock: different ways to manipulate and WRITE the FINDTEXT code.
I have two images on 4k screen and 1 on my 1080 screen. My script is a loop cause when I click on an image, it disappears, so that way it moves on to the next image then BREAKS when none can be found. But you might get something out of my code so I'll share it.

Code: Select all

DllCall("SetThreadDpiAwarenessContext", "ptr", -3, "ptr")    ; add this on top of all your multi-monitor scripts. It fixed issues on mousemoves for me on different screens. 
q::
loop
{
   Text:="|<1>171717-000000$22.zzXzzyDzzkTzw0Twk1zV07w7Xzk7TzU8Xz0QDw0UDU60y0s3k3MQ0U3k01T0M3s3cj0TXw0yDkDzzUzzybzzs"
   Text.="|<2>252525-000000$61.1Uzn1za3sCAqTlYzXDwaCTBkrPVjqv7DauPhokPRvbntBrmTDixbntavnDrrSbnw1Rs3vvj7nvtYrnNgbUMBwkPtUq3o"
   Text.="|<3>171717-000000$22.UzVw1s1k303040A000M001k007U00S001w00Ts00y007k00T000M000U0020008001UK0T0w1s"
	
if !FindText(X, Y, -524, -478, -142, -404, 0, 0, Text)    ; 4k monitor 2
if !FindText(X, Y, -2038, 573, -1488, 805, 0, 0, Text)  ;  4k monitor 2
if !FindText(X, Y, 1673, 15, 1919, 149, 0, 0, Text)        ; now search 1080 Main Monitor
	break
MouseClick, Left, X, Y, 1, 1		
}
return
Last edited by SteveMylo on 16 Jan 2022, 16:18, edited 1 time in total.

chaoscreater
Posts: 60
Joined: 12 Sep 2019, 21:15

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

Post by chaoscreater » 24 Dec 2021, 21:30

chaoscreater wrote:
21 Dec 2021, 18:54
Just continuing from the discussions in the posts above, I just want to share a workaround for the issue that I was having.

Just to re-iterate the issue - the script I'm trying to make is not just for myself. It is for multiple people. I need to make sure that FindText will be able to scan/find the image, regardless of the screen resolution, scaling, or how many monitors that someone is using. I need to also account for performance as well.

For example, let's say I have 7 monitors. If I use something like this:

Code: Select all

if (ok:=FindText(0, 0, 0, 0, 0, 0, Some_Image_To_Scan))
Then it'll take longer to run than if I were to do something like this:

Code: Select all

if ((ok:=FindText(1, 2, 3, 4, 0, 0, Some_Image_To_Scan)) || (ok:=FindText(5, 6, 7, 8, 0, 0, Some_Image_To_Scan)) || (ok:=FindText(9, 10, 11, 12, 0, 0, Some_Image_To_Scan)) || (ok:=FindText(13, 14, 15, 16, 0, 0, Some_Image_To_Scan)) || (ok:=FindText(17, 18, 19, 20, 0, 0, Some_Image_To_Scan)) || (ok:=FindText(21, 22, 23, 24, 0, 0, Some_Image_To_Scan)) || (ok:=FindText(25, 26, 27, 28, 0, 0, Some_Image_To_Scan)))
I know the X1,Y1 and X2,Y2 coordinates don't make sense, but you get the idea. It's much faster to use specific scanning ranges for FindText, in order to quickly locate the image you're trying to scan. The bigger monitor or the higher the resolution, the more areas that FindText needs to scan and the slower the performance.

Now, the image I'm trying to scan is from a specific software. The software can be moved to any of my monitors, each with different screen resolution. If the program is on monitor 1, then it wouldn't make sense to use FindText(0,0,0,0,0,0...), because that will scan ALL monitors. It would make more sense to just scan on monitor 1. So, here's my workaround:

In your main code, add the following function and define the X1, Y1 and X2,Y2 co-ordinates that are specific to each monitor. You can get the values by just using GetRange in FindText and select a specific range that you want to scan for. You can get blahX and blahY by looking at "Active Window Position" in WindowsSpy (right click on Autohotkey icon in your traybar to run it).

Code: Select all

GetAppMonitorPosition:
{
	WinGetPos, blahX, blahY, blahW, blahH, A
	;MsgBox, Connectwise is at %blahX%`,%blahY% and its size is %blahW%x%blahH%	
	
	; Home Dell monitor
	if (blahX = -8 && blahY = -1088)
	{
		Global X1Start := 5
		Global Y1Start := -980
		Global X2Start := 1153
		Global Y2Start := -420
		
		
	}
	
	
	; HP Probook 445 G7  work laptop itself
	if (blahX = -8 && blahY = -8)
	{
		Global X1Start := 0
		Global Y1Start := 0
		Global X2Start := 886
		Global Y2Start := 676
		
		
	}
	
	; Home Asus monitor
	if (blahX = -1928 && blahY = -1089)
	{
		Global X1Start := -1919
		Global Y1Start := -1080
		Global X2Start := -1085
		Global Y2Start := -406
	}
	


	return
}

Then, just before your FindText code runs, just do this:

Code: Select all

Gosub, GetAppMonitorPosition
And finally, update your FindText code to this:

Code: Select all

Some_Image_To_Scan:="|<>*186$44.y00000000000000G01s000CU0n0007c08HY03m021A00sU0UE00A808I003203BA00UU0SCE008000003w000000U"
if (ok:=FindText(X1Start, Y1Start, X2Start, Y2Start, 0, 0, Some_Image_To_Scan))
So basically, depending on which monitor the program is running on, it will only scan using co-ordinates specific to that monitor, which makes performance so much better.







Found a small bug. If X1Start, Y1Start, X2Start and Y2Start do not contain any values in the variable, then for some reason FindText will still work:

Code: Select all

if (ok:=FindText(X1Start, Y1Start, X2Start, Y2Start, 0, 0, Some_Image_To_Scan))
So in your main script, set the following at the top:

Code: Select all

; Set this to be used by all FindText to temporarily block it from working if no matching X1, Y1, X2, Y2 coordinates are found. 
Global X1Start := 1
Global Y1Start := 1
Global X2Start := 1
Global Y2Start := 1
Essentially, this tricks the FindText scanning range to scan at the coordinates 1,1,1,1 and that's such a small spot that it'll just find nothing and fail.

User avatar
SteveMylo
Posts: 233
Joined: 22 Jun 2021, 00:50
Location: Australia
Contact:

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

Post by SteveMylo » 24 Dec 2021, 23:04

Yup I noticed that bug. Cheers for the update. Appreciated

chaoscreater
Posts: 60
Joined: 12 Sep 2019, 21:15

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

Post by chaoscreater » 25 Dec 2021, 04:17

Sorry, found another issue with the previous approach. If the app is running in fullscreen, then the blahX and blahY values generated by WinGetPos will not be the same when the app is running in non-fullscreen:

Code: Select all

WinGetPos, blahX, blahY, blahW, blahH, A
The goal is to check which monitor the app is running on (regardless of if the app is running in fullscreen or not). Based on this, I've created a new approach below. Note that the 2nd parameter of the function is not really used, but can be extended in the future if required.

Code: Select all

GetMonitorIndexFromWindow(WinActive("ahk_exe Authy Desktop.exe"),"ahk_exe Authy Desktop.exe")
OR this:

Code: Select all

GetMonitorIndexFromWindow(WinActive("A"),"")


Code: Select all

GetMonitorIndexFromWindow(windowHandle, AppName)
{
	; Starts with 1.
	Global monitorIndex := 1
	Global monitorLeft := 1
	Global monitorTop := 1
	Global monitorRight := 1
	Global monitorBottom := 1
	Global blahX := 1
	Global blahY := 1
	Global blahW := 1
	Global blahH := 1	


	VarSetCapacity(monitorInfo, 40)
	NumPut(40, monitorInfo)
	
	if (monitorHandle := DllCall("MonitorFromWindow", "uint", windowHandle, "uint", 0x2)) 
		&& DllCall("GetMonitorInfo", "uint", monitorHandle, "uint", &monitorInfo) 
	{
		monitorLeft   := NumGet(monitorInfo,  4, "Int")
		monitorTop    := NumGet(monitorInfo,  8, "Int")
		monitorRight  := NumGet(monitorInfo, 12, "Int")
		monitorBottom := NumGet(monitorInfo, 16, "Int")
		workLeft      := NumGet(monitorInfo, 20, "Int")
		workTop       := NumGet(monitorInfo, 24, "Int")
		workRight     := NumGet(monitorInfo, 28, "Int")
		workBottom    := NumGet(monitorInfo, 32, "Int")
		isPrimary     := NumGet(monitorInfo, 36, "Int") & 1

		SysGet, monitorCount, MonitorCount

		Loop, %monitorCount%
		{
			SysGet, tempMon, Monitor, %A_Index%

			; Compare location to determine the monitor index.
			if ((monitorLeft = tempMonLeft) and (monitorTop = tempMonTop)
				and (monitorRight = tempMonRight) and (monitorBottom = tempMonBottom))
			{
				monitorIndex := A_Index
				break
			}
		}
	}
	
	
	
	; You can uncomment this part to get all the values for your monitor and populate them in the sections below
	/*
	tooltip monitor ID = %monitorIndex%
	sleep, 3000
	tooltip monitor left = %monitorLeft%
	sleep, 3000
	tooltip monitor right = %monitorRight%
	sleep, 3000
	tooltip monitor top = %monitorTop%
	sleep, 3000
	tooltip monitor bottom = %monitorBottom%
	sleep, 3000
	*/
	

	; This is not really used for anything at the moment, but this gets the X, Y coordinates of the app (not the monitor's info). This uses the AppName from the 2nd parameter of the function.
	WinGetPos, blahX, blahY, blahW, blahH, %AppName%
	; tooltip, %AppName% is at %blahX%`,%blahY% and its size is %blahW%x%blahH%	
	
	
	; HP Probook 445 G7  work laptop itself 
	if (monitorIndex = 1) AND (monitorRight = 1920) AND (monitorBottom = 1080)
	{
		if WinActive("ahk_exe ConnectWiseManage.exe") OR WinActive("ahk_exe ConnectWise.exe")
		{
			Global X1Start := 0
			Global Y1Start := 0
			Global X2Start := 886
			Global Y2Start := 676
		
		}else if WinActive("ahk_exe Teams.exe")
		{
			
			Global X1Start := 664
			Global Y1Start := 99
			Global X2Start := 1868
			Global Y2Start := 971
		
		}else if WinActive("ahk_exe Slack.exe")
		{

			Global X1Start := 1172
			Global Y1Start := 50
			Global X2Start := 1918
			Global Y2Start := 1016
		

		}else if WinActive("ahk_exe Authy Desktop.exe")
		{
			; Coordinates highlighting the entire desktop (except for taskbar)
			Global X1Start := 0
			Global Y1Start := 0
			Global X2Start := 1919
			Global Y2Start := 1011
					

		}else if WinActive("ahk_exe sdfsdfdsfdsfdsfdsfds.exe")
		{
			
			Global X1Start := 
			Global Y1Start := 
			Global X2Start := 
			Global Y2Start := 
					

		}else if WinActive("ahk_exe sdfsdfdsfdsfdsfdsfds.exe")
		{
			
			Global X1Start := 
			Global Y1Start := 
			Global X2Start := 
			Global Y2Start := 
					

		}else if WinActive("ahk_exe sdfsdfdsfdsfdsfdsfds.exe")
		{
			
			Global X1Start := 
			Global Y1Start := 
			Global X2Start := 
			Global Y2Start := 
					

		}else if WinActive("ahk_exe sdfsdfdsfdsfdsfdsfds.exe")
		{
			
			Global X1Start := 
			Global Y1Start := 
			Global X2Start := 
			Global Y2Start := 
					

		}else{
			
			Global X1Start := 0
			Global Y1Start := 0
			Global X2Start := 0
			Global Y2Start := 0
			
		}
		
	}
	
	
	
	
	; Home Dell monitor
	else if (monitorIndex = 3) AND (monitorRight = 2048) AND (monitorTop = -1080)
	{
		
		if WinActive("ahk_exe ConnectWiseManage.exe") OR WinActive("ahk_exe ConnectWise.exe")
		{		
		
			Global X1Start := 5
			Global Y1Start := -980
			Global X2Start := 1153
			Global Y2Start := -420

		}else if WinActive("ahk_exe Teams.exe")
		{
		
			Global X1Start := 709
			Global Y1Start := -967
			Global X2Start := 1993
			Global Y2Start := -73
		
		}else if WinActive("ahk_exe Slack.exe")
		{

			Global X1Start := 1416
			Global Y1Start := -1030
			Global X2Start := 2046
			Global Y2Start := -102
		

		}else if WinActive("ahk_exe Authy Desktop.exe")
		{
			
			; Coordinates highlighting the entire desktop (except for taskbar)
			Global X1Start := 0
			Global Y1Start := -1079
			Global X2Start := 2046
			Global Y2Start := -33
					

		}else if WinActive("ahk_exe sdfsdfdsfdsfdsfdsfds.exe")
		{
			
			Global X1Start := 
			Global Y1Start := 
			Global X2Start := 
			Global Y2Start := 
					

		}else if WinActive("ahk_exe sdfsdfdsfdsfdsfdsfds.exe")
		{
			
			Global X1Start := 
			Global Y1Start := 
			Global X2Start := 
			Global Y2Start := 
					

		}else if WinActive("ahk_exe sdfsdfdsfdsfdsfdsfds.exe")
		{
			
			Global X1Start := 
			Global Y1Start := 
			Global X2Start := 
			Global Y2Start := 
					

		}else if WinActive("ahk_exe sdfsdfdsfdsfdsfdsfds.exe")
		{
			
			Global X1Start := 
			Global Y1Start := 
			Global X2Start := 
			Global Y2Start := 
					

		}else{
			
			Global X1Start := 0
			Global Y1Start := 0
			Global X2Start := 0
			Global Y2Start := 0
			
		}
		
	}
	
	
	
	
	
	; Home Asus monitor
	else if (monitorIndex = 2) AND (monitorLeft = -1920) AND (monitorTop = -1081)
	{
		
		if WinActive("ahk_exe ConnectWiseManage.exe") OR WinActive("ahk_exe ConnectWise.exe")
		{
				
			Global X1Start := -1919
			Global Y1Start := -1080
			Global X2Start := -1085
			Global Y2Start := -406

		}else if WinActive("ahk_exe Teams.exe")
		{
			Global X1Start := -1257
			Global Y1Start := -978
			Global X2Start := -41
			Global Y2Start := -74
		
		}else if WinActive("ahk_exe Slack.exe")
		{

			Global X1Start := -615
			Global Y1Start := -1041
			Global X2Start := -1
			Global Y2Start := -39
		

		}else if WinActive("ahk_exe Authy Desktop.exe")
		{
			
			Global X1Start := -1919
			Global Y1Start := -1080
			Global X2Start := -3
			Global Y2Start := -36
					

		}else if WinActive("ahk_exe sdfsdfdsfdsfdsfdsfds.exe")
		{
			
			Global X1Start := 
			Global Y1Start := 
			Global X2Start := 
			Global Y2Start := 
					

		}else if WinActive("ahk_exe sdfsdfdsfdsfdsfdsfds.exe")
		{
			
			Global X1Start := 
			Global Y1Start := 
			Global X2Start := 
			Global Y2Start := 
					

		}else if WinActive("ahk_exe sdfsdfdsfdsfdsfdsfds.exe")
		{
			
			Global X1Start := 
			Global Y1Start := 
			Global X2Start := 
			Global Y2Start := 
					

		}else if WinActive("ahk_exe sdfsdfdsfdsfdsfdsfds.exe")
		{
			
			Global X1Start := 
			Global Y1Start := 
			Global X2Start := 
			Global Y2Start := 
					

		}else{
			
			Global X1Start := 0
			Global Y1Start := 0
			Global X2Start := 0
			Global Y2Start := 0
			
		}

		
	}	
	

	return monitorIndex, monitorLeft, monitorRight, monitorTop, monitorBottom
	
}

Basically, it'll check against the app that you specify and look at which monitor it is running on and based on the monitor found, it'll load the appropriate FindText scanning range for your active app.

Also, in case there isn't a pre-defined scanning range for your app, it'll just default to use 0,0,0,0 and so it should still be able to scan ALL monitors as a last resort.

Lastly, here's a snippet of how I would use a WHILE loop to find an image:


Code: Select all

		AuthyMainScreenNotFound := True

		While (AuthyMainScreenNotFound = True)
		{
			sleep, 50
		
			if ((ok:=FindText(X1Start, Y1Start, X2Start, Y2Start, 0, 0, Authy_SettingsIcon_BrightScreen)) || (ok:=FindText(X1Start, Y1Start, X2Start, Y2Start, 0, 0, Authy_SettingsIcon2_BrightScreen)) || (ok:=FindText(X1Start, Y1Start, X2Start, Y2Start, 0, 0, Authy_SettingsIcon_YellowTint)))
			{
				
				AuthyMainScreenNotFound := False
				tooltip						
			
			}else{
			
				tooltip "Authy main screen not found"
				AuthyMainScreenNotFound := True
				
				GetMonitorIndexFromWindow(WinExist("ahk_exe Authy Desktop.exe"),"ahk_exe Authy Desktop.exe")

			}
		
		}		
		

maxkill
Posts: 173
Joined: 11 Apr 2016, 13:03

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

Post by maxkill » 28 Dec 2021, 17:18

SteveMylo wrote:
12 Nov 2021, 09:10
maxkill wrote:
11 Nov 2021, 17:17
3. how do I move the cursor slightly after image found if I want to adjust the exactness of coordinates found?
To adjust the coordinates , After you capture your image,
  • Double click on the image/Text String (as seen in Pic attached) which highlights blue
  • Then click paste , which is below the CaptureS button.
  • Then click the 'Get Offset 2' Button.
  • Then click where you really want the mouse to move using the same as Capture method
and BOOM! , the offset coordinates will be automatically pasted next to the button.

Then it's up to you to paste those and replace the X,Y, in your code ===> FindText().Click(X, Y, "L")

Image
Hello again,
I have trouble understanding how to make this work
Image
https://ibb.co/nLn84X5
how do I put in code exactly to search that rectangle area only left of mouse where red arrow is?
the box should move if i move the mouse always same distance/area from mousepointer

edit: forgot to mention, search box should only move on the x axis for this purpose
Find Jesus to be saved. Repent (stop all sinning), believe (the gospel) and get baptised to be saved.

besimilar
Posts: 4
Joined: 25 Dec 2021, 09:25

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

Post by besimilar » 28 Dec 2021, 23:48

Hi @feiyue,

Thanks for creating such useful tool!

I tried this tool but found it will ignore the mouse cursor by default. The cursor shape is what I am searching for. Is there any way to enable mouse cursor?

Oh, nvm. I just read the code, we can enable it from here. I thought I need to modify the method you created, but finally realized that I just need to call FindText().CaptureCursor(1) before doing invoking FindText()

Code: Select all

; Use FindText().CaptureCursor(1) to Capture Cursor
; Use FindText().CaptureCursor(0) to Cancel Capture Cursor

CaptureCursor(hDC:=0, zx:=0, zy:=0, zw:=0, zh:=0, get_cursor:=0)
{
  local
  if (get_cursor)
    return this.Cursor
  if (hDC=1 or hDC=0) and (zw=0)
  {
    this.Cursor:=hDC
    return
  }
  VarSetCapacity(mi, 40, 0), NumPut(16+A_PtrSize, mi, "int")
  DllCall("GetCursorInfo", "Ptr",&mi)
  bShow   := NumGet(mi, 4, "int")
  hCursor := NumGet(mi, 8, "Ptr")
  x := NumGet(mi, 8+A_PtrSize, "int")
  y := NumGet(mi, 12+A_PtrSize, "int")
  if (!bShow) or (x<zx or y<zy or x>=zx+zw or y>=zy+zh)
    return
  VarSetCapacity(ni, 40, 0)
  DllCall("GetIconInfo", "Ptr",hCursor, "Ptr",&ni)
  xCenter  := NumGet(ni, 4, "int")
  yCenter  := NumGet(ni, 8, "int")
  hBMMask  := NumGet(ni, (A_PtrSize=8?16:12), "Ptr")
  hBMColor := NumGet(ni, (A_PtrSize=8?24:16), "Ptr")
  DllCall("DrawIconEx", "Ptr",hDC
    , "int",x-xCenter-zx, "int",y-yCenter-zy, "Ptr",hCursor
    , "int",0, "int",0, "int",0, "int",0, "int",3)
  DllCall("DeleteObject", "Ptr",hBMMask)
  DllCall("DeleteObject", "Ptr",hBMColor)
}
Thank you!

User avatar
SteveMylo
Posts: 233
Joined: 22 Jun 2021, 00:50
Location: Australia
Contact:

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

Post by SteveMylo » 29 Dec 2021, 06:58

@maxkill
Is the red arrow your cursor or just an image?
Do you need to constantly Seth every millisecond or everytime not often?
I don’t think you need the FindTEXT Function for this, you would need a script that constantly knows the mouse cursor position, then only search in the X axis in the box coordinates.
Since the box is fixed to follow the mouse, it should be easy just to workout the X axis search range.

maxkill
Posts: 173
Joined: 11 Apr 2016, 13:03

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

Post by maxkill » 14 Jan 2022, 11:19

SteveMylo wrote:
29 Dec 2021, 06:58
@maxkill
Is the red arrow your cursor or just an image?
Do you need to constantly Seth every millisecond or everytime not often?
I don’t think you need the FindTEXT Function for this, you would need a script that constantly knows the mouse cursor position, then only search in the X axis in the box coordinates.
Since the box is fixed to follow the mouse, it should be easy just to workout the X axis search range.
It's supposed to be the mouse cursor (an illustration).
Can you help me with this script? I need one both left and right of mouse so would be nice to get it!
Find Jesus to be saved. Repent (stop all sinning), believe (the gospel) and get baptised to be saved.

User avatar
SteveMylo
Posts: 233
Joined: 22 Jun 2021, 00:50
Location: Australia
Contact:

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

Post by SteveMylo » 16 Jan 2022, 17:39

maxkill wrote:
14 Jan 2022, 11:19
Can you help me with this script? I need one both left and right of mouse so would be nice to get it!
Here is my script to help you. It searches around the mouse cursor in a loop every 22ms. It will search the Left side of the mouse 1st in a rectangle range of your choice, then the right side.
Once found, it will close the loop.
*Please NOTE... that the rectangle search range must be big enough to encapsulate the entire image. Also, do you have the new version of FINDTEXT? was updated last September. This script won't work unless you have the updated version.
If not then replace if (ok:=FindText(X, Y, with ====> if (ok:=FindText(0,0,

Code: Select all

DllCall("SetThreadDpiAwarenessContext", "ptr", -3, "ptr")    ; add this on top of all your scripts if you need to click or search/click on different monitors. 

q::
Loop
{
sleep, 22
MouseGetPos, aX, aY

Text:="|<>3E84C2-000000$4.F4F4F4F7zzv8U"
if (ok:=FindText(X, Y,  aX-300, aY-100, aX-100, aY+100, 0, 0, Text))  ; Left side search range rectangle
{
  MouseMove, X, Y, 2
  return
}

if (ok:=FindText(X, Y,  aX+300, aY-100, aX+100, aY+100, 0, 0, Text))   Right side search range rectangle
{
  MouseMove, X, Y, 2
  return
} 
}  ; end loop


return

Esc::
Reload

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

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

Post by feiyue » 23 Jan 2022, 17:41

Updated to 8.7 version - 2022/01/24 :dance: :beer:

1. Add: Several functions are added: ShowScreenShot(), WaitChange(), GetPicHash(), objview().

2. Modify: When capturing the screen image, you can use the arrow keys
(Up/Down/Left/Right) to adjust the size of the selection box.

3. Add: The return value of the FindText() function is cached in the OK key
and can be easily obtained when necessary. (ok:=FindText().ok)

User avatar
SteveMylo
Posts: 233
Joined: 22 Jun 2021, 00:50
Location: Australia
Contact:

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

Post by SteveMylo » 24 Jan 2022, 00:23

feiyue wrote:
23 Jan 2022, 17:41
3. Add: The return value of the FindText() function is cached in the OK key
and can be easily obtained when necessary. (ok:=FindText().ok)
Thanks so much! So how does 3. work exactly? (ok:=FindText().ok) ??

srooo
Posts: 5
Joined: 05 Jun 2019, 14:50

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

Post by srooo » 25 Jan 2022, 01:47

feiyue wrote:
23 Jan 2022, 17:41
Updated to 8.7 version - 2022/01/24 :dance: :beer:

1. Add: Several functions are added: ShowScreenShot(), WaitChange(), GetPicHash(), objview().

2. Modify: When capturing the screen image, you can use the arrow keys
(Up/Down/Left/Right) to adjust the size of the selection box.

3. Add: The return value of the FindText() function is cached in the OK key
and can be easily obtained when necessary. (ok:=FindText().ok)
It is recommended to add RGB conversion to HSV or HSL for more flexible use
FindText.GetColor(x,y) == "0xE9CC62"
FindText.GetHSV.H(x,y) == 47
FindText.GetHSV.S(x,y) == 57.9
FindText.GetHSV.V(x,y) == 91.4

User avatar
SteveMylo
Posts: 233
Joined: 22 Jun 2021, 00:50
Location: Australia
Contact:

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

Post by SteveMylo » 26 Jan 2022, 17:02

Here is a TUTORIAL on different ways to use amazing MOUSECLICK methods.
Basically if your FindText() image search finds multiples of the same image, then this allows you to choose which one.
These I have figured out over time due to lack of tutorials regarding which instances to click on after a FINDTEXT search, using its inbuilt Object/arrays.


Also below I show you how to change the ' Search Direction'
Version : 8.7 - Updated Date : 2022-01-24

4 different Click/Move methods

Method1:: MouseClick, Left, ok[1].x, ok[1].y, 1, 1

If you want to click on instance Number 4 of images found, then replace [1] with [4] e.g. MouseClick, Left, ok[4].x, ok[4].y, 1, 1
If you want to click/move on Image 2's X coordinate but Image 1's Y coordinate, then just do as follows MouseMove, ok[2].x, ok[1].y, 3 AMAZING hey!!
Or combine multiple clicks/moves

Code: Select all

#Include <FindText>   ; does not need to be added if your FindText.ahk script is in your \AutoHotkey\Lib' folder
x::
Text:="|<>D9D4D4-000000$6.SzzzzSU"
if (ok:=FindText(X, Y, 0, 0, 0, 0, 0, 0, Text,,,,,,1))   ; search range of ( 0,0,0,0 ) represents search entire Monitor Size
{
  MouseClick, Left, ok[1].x, ok[1].y, 1, 1
  MouseClick, Left, ok[3].x, ok[3].y, 1, 1
  MouseMove, ok[5].x, ok[5].y, 1
}
return
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------


Method2:: Click(1) ; Can't control mouse speed, stays on whatever the function is set to

Replace (1) with (2) or (3) etc etc to click on different instances found.
This is just a quick way of coding a mouseclick function. It struggles when I use a loop scripts. but it can be super handy without loops.

Code: Select all

#Include <FindText>
x::
Text:="|<>D9D4D4-000000$6.SzzzzSU"
if (ok:=FindText(X, Y, 0, 0, 0, 0, 0, 0, Text,,,,,,1))
{
  Click(1)   ; you can combine them on one line if you wish  Click(1), Click(3), Click(4)
  Click(3)
  Click(4)
}
return
----------------------------------------------
  • For Method2:: Click(1) to actually work, please paste the below function into your #include <Findtext> script function.
    I just paste it after the 1st FINDTEXT function ==> FindText(ByRef x:="FindTextClass", ByRef y:="", args*)

Code: Select all

  Click(i) {
    global ok
     {
        MouseClick,, ok[i].1+ok[i].3//2, ok[i].2+ok[i].4//2, 1, 1
        Sleep, 111
     }
}

--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
Method3:: FindText().Click(X, Y, "L")

This is an inbuilt 'click function' from the version that was updated in September 2021,
This script can be an all in one solution with my fix. now you can Change Click Up, Left, Right, Speed and instance
I have changed this function to add 'speed' on the end which is NEEDED!
So in the #include <FindText> script find the Click() function Click(x:="", y:="", other:="") and swap it out with my small change.

Code: Select all

  ; ; Find this Fucniton 
Click(x:="", y:="", other:="")
{
  local
  bak:=A_CoordModeMouse
  CoordMode, Mouse, Screen
  MouseMove, x, y, 0
  Click, %x%, %y%, %other%
  CoordMode, Mouse, %bak%
}
Now swap to with this one which adds a speed parameter.

Code: Select all

Click(x:="", y:="", other:="",  speed:="")
{
  local
  bak:=A_CoordModeMouse
  CoordMode, Mouse, Screen
  MouseMove, x, y, %speed%
  Click, %x%, %y%, %other%
  CoordMode, Mouse, %bak%
}
Now that we have done that, this script can be an all in one solution.
So to choose which instance to click on just change your code to FindText().Click(ok[1].x, ok[1].y, "U" , 1)
notice how there is now an added speed parameter on the end.
So Now you can Replace "L" with "U" for mouse move or "R" for right-click
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
Method4:: FindText_Control_Click(ok, ok[1].x, ok[1].y, ahkEXE:="ahk_exe chrome.exe")

This is a control-click so the mouse doesn't move, so it instantly 'Clicks' on what you want. Change ok[1].x, ok[1].y to the image number you want to click on e.g. ok[4].x, ok[4].y
  • For Method4:: FindText_Control_Click(ok, ok[1].x, ok[1].y, ahkEXE:="ahk_exe chrome.exe") to actually work, Just add the below Function into your #include <Findtext> script function (see code below)
    It was written by Joe Glines, I have modified it for the Current version.

Code: Select all

FindText_Control_Click(Obj,X,Y,ahkEXE=""){
	;~ SetControlDelay -1   ( I turned off SetControlDelay here cause it was causing issues if I had it on my actual script, so I just set it to SetControlDelay -1 in my actual script
	ControlClick,x%x% y%y%,ahk_exe %ahkEXE%,,,,NA
}
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------

Here is how you change the search Direction.

Text:="|<GREEN>0x0EC218@1.00$6.SzzzzSU"
if (ok:=FindText(X, Y, 0, 0, 1920, 1080, 0, 0, Text,,,,,,1))


After the 6 commas,,,,,, that is after the variable "Text", change the "1" to change SEARCH Direction. e.g. if (ok:=FindText(X, Y, 0, 0, 1920, 1080, 0, 0, Text,,,,,,6))
Also note, if your search range is 4 (0's) this actually represents search entire monitor screen. if (ok:=FindText(X, Y, 0, 0, 0, 0, 0, 0, Text,,,,,,1))
But if you choose search from the centre outwards which is Number '9', then you can't have 4 '0's' , you must have a proper search range e.g. if (ok:=FindText(X, Y, 0, 0, 1920, 1080, 0, 0, Text,,,,,,9))

@feiyue maybe add this Direction description to the top of this forum?
1 = Starts Top Left & Scans Right. then it scans again from 1 Pixel down from the Top Left and it scans Right again etc. etc.

2 = TR - Scan L
3 = BL Scan R
4 = BR scan L
5 = TL Scan D
6 = BL - Scan U
7 = TR Scan D
8 = BR scan U
9 = Starts at the Centre and scans outward in a circle
Last edited by SteveMylo on 11 Mar 2022, 17:38, edited 2 times in total.

Post Reply

Return to “Scripts and Functions (v1)”