FindText - Capture screen image into text and then find it

Post your working scripts, libraries and tools for AHK v1.1 and older
maxkill
Posts: 158
Joined: 11 Apr 2016, 13:03

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

Post by maxkill » 08 Jun 2022, 15:19

SteveMylo wrote:
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
Thanks got it working for my purposes :bravo:
(searches area left of mouse pointer finds image saves one axis and moves mouse to a combo of another presaved coordinates with one from image)

Code: Select all

CoordMode, Mouse
MouseGetPos, aX, aY


blockinput, on
CoordMode, relative
Mousegetpos, xx, yy
CoordMode, Mouse, Screen
sleep, 100
Text:="|<>*90$26.tyONyTYaTbtAjtwn3yTBkzXaSDw7bbs"
if (ok:=FindText(xx-1200, yy+2400, xx, yy+100, 0, 0, Text)) ; 150 can be adjusted by yourself
;första xx höger från mousep +, sista yy ner från mousep + (första yy - ger upp)
{
  xx:=ok.1.1, yy:=ok.1.2, w:=ok.1.3, h:=ok.1.4
  mousemove, xx+3.5, aY+0
click left
}
;sparar y och hittar image sparar där x flyttar ihop dom.
blockinput, off
return
Last edited by maxkill on 20 Jul 2022, 07:38, edited 1 time in total.

Manafique69
Posts: 1
Joined: 15 Jun 2022, 11:21

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

Post by Manafique69 » 15 Jun 2022, 11:24

Some1 knows why the compiled ahk with ahk h wont start if im adding the thing with "copy 1 time after ur code" i had a older version and it worked but with that its not workin

N_athan
Posts: 40
Joined: 21 Aug 2021, 16:40

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

Post by N_athan » 24 Jun 2022, 11:30

I was reading the findtext source

Why this:

Code: Select all

FindText(ByRef OutputX:="", ByRef OutputY:=""
  , x1:="", y1:="", x2:="", y2:="", err1:="", err0:=""
  , text:="", ScreenShot:="", FindAll:=""
  , JoinText:="", offsetX:="", offsetY:="", dir:=""
  , zoomW:=1, zoomH:=1) {

      (err1="" && err1:=0), (err0="" && err0:=0)
      , (ScreenShot="" && ScreenShot:=1)
      , (FindAll="" && FindAll:=1)
      , (JoinText="" && JoinText:=0)
      , (offsetX="" && offsetX:=20)
      , (offsetY="" && offsetY:=10)
      , (dir="" && dir:=1)
Instead of declaring the parameters in the header?

Code: Select all

FindText(ByRef OutputX:="", ByRef OutputY:=""
  , x1:="", y1:="", x2:="", y2:="", err1:=0, err0:=0
  , text:="", ScreenShot:=1, FindAll:=1
  , JoinText:=0, offsetX:=20, offsetY:=10, dir:=1
  , zoomW:=1, zoomH:=1) {
  
  ...

}
inside of PicInfo(text) {
What is this DllCall for?

Code: Select all

  key:=(r:=StrLen(text))<10000 ? text
    : DllCall("ntdll\RtlComputeCrc32", "uint",0
    , "Ptr",&text, "uint",r*(1+!!A_IsUnicode), "uint")
Why not just

Code: Select all

      if (info[text])
         return info[text]
Wouldnt be better to keep ScreenShot things inside of itself?

Code: Select all

   ScreenShot(x1:=0, y1:=0, x2:=0, y2:=0)
   {

      ;this.FindText(0, 0, x1, y1, x2, y2)

      if (x1*x1+y1*y1+x2*x2+y2*y2<=0)
         n:=150000, x:=y:=-n, w:=h:=2*n
      else
         x:=Min(x1,x2), y:=Min(y1,y2), w:=Abs(x2-x1)+1, h:=Abs(y2-y1)+1
      
      this.GetBitsFromScreen(x,y,w,h,1,zx,zy,zw,zh) 

   }
Im not criticizing anything, just trying to understand the source, btw great job.

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

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

Post by feiyue » 27 Jun 2022, 02:18

N_athan wrote:
24 Jun 2022, 11:30
I was reading the findtext source

Why this:

Code: Select all

FindText(ByRef OutputX:="", ByRef OutputY:=""
  , x1:="", y1:="", x2:="", y2:="", err1:="", err0:=""
  , text:="", ScreenShot:="", FindAll:=""
  , JoinText:="", offsetX:="", offsetY:="", dir:=""
  , zoomW:=1, zoomH:=1) {

      (err1="" && err1:=0), (err0="" && err0:=0)
      , (ScreenShot="" && ScreenShot:=1)
      , (FindAll="" && FindAll:=1)
      , (JoinText="" && JoinText:=0)
      , (offsetX="" && offsetX:=20)
      , (offsetY="" && offsetY:=10)
      , (dir="" && dir:=1)
Instead of declaring the parameters in the header?

Code: Select all

FindText(ByRef OutputX:="", ByRef OutputY:=""
  , x1:="", y1:="", x2:="", y2:="", err1:=0, err0:=0
  , text:="", ScreenShot:=1, FindAll:=1
  , JoinText:=0, offsetX:=20, offsetY:=10, dir:=1
  , zoomW:=1, zoomH:=1) {
  
  ...

}
This is for compatibility with functions before v8.5, because two parameters are added in front of functions after v8.6

N_athan wrote:
24 Jun 2022, 11:30
inside of PicInfo(text) {
What is this DllCall for?

Code: Select all

  key:=(r:=StrLen(text))<10000 ? text
    : DllCall("ntdll\RtlComputeCrc32", "uint",0
    , "Ptr",&text, "uint",r*(1+!!A_IsUnicode), "uint")
Why not just

Code: Select all

      if (info[text])
         return info[text]
I don't want to use too long strings as keys. Maybe it doesn't matter.

N_athan wrote:
24 Jun 2022, 11:30

Wouldnt be better to keep ScreenShot things inside of itself?

Code: Select all

   ScreenShot(x1:=0, y1:=0, x2:=0, y2:=0)
   {

      ;this.FindText(0, 0, x1, y1, x2, y2)

      if (x1*x1+y1*y1+x2*x2+y2*y2<=0)
         n:=150000, x:=y:=-n, w:=h:=2*n
      else
         x:=Min(x1,x2), y:=Min(y1,y2), w:=Abs(x2-x1)+1, h:=Abs(y2-y1)+1
      
      this.GetBitsFromScreen(x,y,w,h,1,zx,zy,zw,zh) 

   }
You're right. There's really no need to just reduce a few lines of code.

manjyomethunder
Posts: 6
Joined: 06 Feb 2021, 11:15

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

Post by manjyomethunder » 28 Jun 2022, 23:04

hello, your script is very helpful
i just want to know, the right code for this using ~LButton:: and your findtext

Code: Select all

~Lbutton::
Keywait, LButton
MouseGetPos x,y
if ((x>57) and (x<178) and (y>594) and (y<610))
  if (ok:=FindText(5,181,318,350,0,0,"|<brake lights can't tell>[email protected]$70.w0zzzzzzzzzzV1zzzzzzzzzwTXzzzzzzzzzbzbzkTzz7y0ATyDy8zzwFz7nzwzllzzl7wTDznz7s610DlUzzDwTa8Xlz6HzyzlzsaD7wFDznz7s2MwTl0zzDwQa9Xlz6FzszskMaD7wMbzbzk80MwDln7szzzzzzzzzy47zzzzzzzzzw0zzzzzzzzzy"))
  FindText_Left_Click(Ok,X_Adj:=0,Y_Adj:=0,MoveBack:=1)
Return
this is working properly if i click at a specific area only (if ((x>57) and (x<178) and (y>594) and (y<610)))
what is the right code for that if i scroll the page a little and click outside the specific area with same rectangular range
thanks.

and also, the mouse move code is having an error to me

Code: Select all

FindText_Move_Mouse(Ok,X_Adj:=0,Y_Adj:=0,MoveBack:=0)
error

Code: Select all

Error: Too many parameters passed to function.
Specifically: FindText_Move_Mouse(Ok,X_Adj:=0,Y_Adj:=0,MoveBack:=0)

manjyomethunder
Posts: 6
Joined: 06 Feb 2021, 11:15

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

Post by manjyomethunder » 29 Jun 2022, 21:03

what i really want to happen is like this
whenever i click the green box, it will auto click the red box
ss(01).png
ss(01).png (21.22 KiB) Viewed 4161 times
with my current code above it is working but need the green box is in exact specific area
but that area is scrollable.

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 Jun 2022, 23:16

manjyomethunder wrote:
29 Jun 2022, 21:03
what i really want to happen is like this whenever I click the green box, it will auto-click the red box
G'day. I have tested this code and it works going off YOUR images provided.
Firstly, please install the latest FINDTEXT function, if you have an older version I don't think this will work. See the 1st page of this thread for the download link.

The most important and tricky part is using the CAPTURE Method.
MultiColor is really the only one that will work to get to distinguish between the different coloured circles when clicked. Message me if you want a tutorial on how I did that.
Please note, that 'My CODE' may not work for you as I'm using the CAPTURE Method of your screenshot. But worth a try.
Also if your screen resolution/DPI and or SCALE are different it definitely won't work.

Basically, my code will wait 60 seconds for you to click the 1st checkbox Circle. which means you can scroll anywhere and click on it when you are ready.
image.png
MultiColour
image.png (5.72 KiB) Viewed 4071 times
so when you click 'BOTH Can't Tell' ....FINDTEXT will then move on to find the 3rd circle which is 'Can't Tell' Again, it will wait for 60 seconds incase it was off screen due to scrolling.

Code: Select all

#Include <FindText>
x::   ; You shouldn't use LButton now, cause this code will detect if you clicked the 1st CheckBox

Text:="|<NonClicked>##5$0/0/EAE9ED,5/0/F8F8F8,11/1/ECECEC,15/1/EAE9ED,11/2/FFFFFF,2/2/FFFFFF,-2/3/EAE9ED,6/4/E5E5E5,14/4/E6E6E7,16/5/EAE9ED,1/5/FFFFFF,-2/6/EAE9ED,4/7/E5E5E5,11/7/E6E6E6,15/7/EAE9ED,12/8/FFFFFF,3/8/E5E5E5,0/10/E8E8E8,8/10/E5E5E5,15/11/EAE9ED,5/11/EBEBEB,5/14/E5E5E6,9/15/EAE9ED,7/13/FCFCFC,7/12/FFFFFF,11/11/FFFFFF"

ok:=FindText("wait",60, 0,0,0,0,0,0,Text)  ; waits for 60 seconds , change to as long or as short as you like
if (ok:=FindText(X, Y, 0, 0, 0, 0, 0, 0, Text,,,,,,1))
{

	soundbeep
	Text:="|<NonClicked>##5$0/0/E8E8E8,0/3/E8E8E8,15/3/E8E8E8,15/0/E8E8E8,6/-6/E8E8E8,7/-6/E5E5E5,9/-6/E8E8E8,5/9/EEEEEE,7/9/E5E5E5,9/9/E8E8E8,3/3/FFFFFF,6/-1/FFFFFF,10/-1/FFFFFF,9/5/FFFFFF,7/6/FFFFFF,6/2/FFFFFF,11/1/FFFFFF,10/-2/FFFFFF,6/-3/FFFFFF,5/-3/FFFFFF,2/4/FFFFFF,-3/4/FFFFFF,-3/1/FFFFFF,-2/-1/FFFFFF,-3/-3/FFFFFF,18/-3/FFFFFF,17/-3/FFFFFF,20/2/FFFFFF,18/6/FFFFFF,15/2/E5E5E5,11/-4/FCFCFC,1/4/EFEFEF,8/9/E5E5E5,10/9/EEEEEE,14/5/E5E5E5,14/4/EFEFEF,8/1/FFFFFF,11/-1/FFFFFF"


	ok:=FindText("wait",60, 0,0,0,0,0,0,Text)
	if (ok:=FindText(X, Y, 0, 0, 0, 0, 0, 0, Text,,,,,,1))
	{
	  soundbeep
	  FindText().Click(ok[3].x, ok[3].y, "L")  ; the number 3  ok[3]  represents the 3rd occurence found.
	}
}
return
image.png
Clicked Circle
image.png (1.28 KiB) Viewed 4071 times

BaBa44
Posts: 5
Joined: 18 Feb 2022, 05:33

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

Post by BaBa44 » 05 Jul 2022, 02:46

Hey everybody!

First of all - thank you for this awesome function!
After I changed from AHK's built-in ImageSearch, I use this extensive now ^.^

BUT unfortunately I somehow broke my GUI-Screen:
Spoiler
Even if I capture a new Image it only adds the Text-var with it's Image-Text, but not the defaults of the script itself.

How can I "reset" the GUI to show the default script again?

In case it's not clear what I'm talking about - with "defaults", I'm talking about what's in FindText.ahk v8.9 Line 3062 and following.

Any help is highly appreciated!

Thanks in advance & kind regards
BaBa

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 » 05 Jul 2022, 06:11

@BaBa44 delete the find text function FINDTEXT.ahk ,download it agian , problem solved.
Eveytime i messed with the function & stuffed up, I could never get it to work again.
So i just reinstalled it so to speak.

BaBa44
Posts: 5
Joined: 18 Feb 2022, 05:33

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

Post by BaBa44 » 05 Jul 2022, 07:03

@SteveMylo
thanks for your reply. Unfortunately it didn't work for me.
Deleted the FindText v8.9.ahk, redownloaded to FindText.ahk (tried with no success) then renamed again to FindText v8.9.ahk and had still no luck. :/

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 » 05 Jul 2022, 19:44

@BaBa44 Can't help you out, maybe someone else can.
In the mean time, here is the previous version. I have made adjustments to it you'll notice but at least you will have a working file. Otherwise track down a pervious version
https://drive.google.com/file/d/1mPN3HTXczp9SG6WSXJuT6SmdHJc_k97B/view?usp=sharing

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

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

Post by maxkill » 20 Jul 2022, 07:34

Hello again. How do we click in the middle of 2 found images?

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 » 20 Jul 2022, 07:57

@maxkill are the two images found in the one search? If yes use this 👇

MouseClick, Left,(( ok[1].x + ok[2].x) / 2 ), ((ok[1].y + ok[2].y) / 2), 1, 1

Assuming the two images are the 1st & 2nd occurrence found. What ever the occurrence is of the image found, just swap out the appropriate number e.g. [1] to [6] or whatever. It’s that easy, cause it has it’s own built in Array

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

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

Post by maxkill » 20 Jul 2022, 19:54

@SteveMylo
Fantastic if this works which I believe it will! So how do we put it into the script, I've never seen this typed out

Here's the default code i use from before.
Do I put the image text codes one after the other
Could you fix my code possibly and put your code into there correctly?
I think it's good if I can still ajust the coordinates like script xx+3.5, aY+0 ..

Code: Select all

MouseClick, Left,(( ok[1].x + ok[2].x) / 2 ), ((ok[1].y + ok[2].y) / 2), 1, 1

Code: Select all

CoordMode, Mouse
MouseGetPos, aX, aY

CoordMode, relative
Mousegetpos, xx, yy
CoordMode, Mouse, Screen

Text:="|<>*90$26.tyONyTYaTbtAjtwn3yTBkzXaSDw7bbs"
if (ok:=FindText(xx-1200, yy+2400, xx, yy+100, 0, 0, Text)) 

{
  xx:=ok.1.1, yy:=ok.1.2, w:=ok.1.3, h:=ok.1.4
  mousemove, xx+3.5, aY+0
click left
}

blockinput, off
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 » 20 Jul 2022, 20:30

@maxkill You need to have the latest FINDTEXT update for this to work, probably from Last September onwards, but I've told you this before. Find it on Page 1.
The Code below will click in between image 1 & 2 found
If you need to offset the mouse you can still do it by adding '+ 50 or whatever at the end of the particular coordinate'
e.g. ((ok[1].x + ok[2].x) / 2), + 50

Code: Select all

x::
Text:="|<Image 1>*75$39.wzz7ztzDzUDzbnzw1zyQzz07ztDzs0zzYzz07ztnzw1zyTDzUDzbwzz7ztw"
Text.="|<Image 2>*71$25.0000DvyzbxzTnyzjtzTrwzjvy0000Ds00000000003zzzy0000Tk0000008000A"
if (ok:=FindText(X, Y, 0, 0, 0, 0, 0, 0, Text))
{
  MouseClick, Left, ((ok[1].x + ok[2].x) / 2), ((ok[1].y + ok[2].y ) / 2), 1, 1
}
return
this will still work with one TEXT line if there are multiple of the same image. The above example is two images just as example.
Always make sure the 1st TEXT line has a colon Text:= and any after has a period. Text.=
Last edited by SteveMylo on 21 Jul 2022, 16:17, edited 1 time in total.

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

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

Post by maxkill » 21 Jul 2022, 12:39

@SteveMylo
I fixed the new FindText file and put it into my random script folder it worked after I put the coordmode, mouse, screen command into it, very cool thanks! :wave:

Code: Select all

;path to your FindText ahk file incl file name extension
#Include, C:\Users\putyourusernamehere\Music\FindText.ahk

q::
coordmode, mouse, screen
Text:="|<Image 1>*190$29.0000001w0003s0007k000DU000TU00zzz03zzz0ADC60MCsA0kDUM1UC0k3Uy1U3bzD03zzs03Xnk077300Dzy00Trw00s0M01w7k01yz000Tk00000000001"
Text.="|<Image 2>*190$20.0000000QMsDjC3zzUzrMCEa1zzUTzs3zw0M6040U1080MC0Dzk7UC1s7UTzsC077U1tzzyTzzbTyszzw0008"
if (ok:=FindText(X, Y, 0, 0, 0, 0, 0, 0, Text))
{
mouseclick, right, ((ok[1].x + ok[2].x) / 2), ((ok[1].y + ok[2].y ) / 2), 1, 1
}
return

+r::reload
Only think I noticed this include method is that it seems slightly slower, is it because I don't have the findtext file in the lib folder?
I felt it was a bit unclear where to create the lib folder that's why I used the inlcude method in script

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

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

Post by maxkill » 21 Jul 2022, 13:17

@SteveMylo
I now tried it with my normal script

Code: Select all

Text:="|<Image 1>*63$12.zznuuijhiuhiuh" 
Text.="|<Image 2>*60$13.iuhiuhiuhiuhiuh"
if (ok:=FindText(xx-200, yy+2400, xx, yy+200, 0, 0, Text)) ; 150 can be adjusted by yourself
{
((ok[1].x + ok[2].x) / 2), ((ok[1].y + ok[2].y ) / 2), 1, 1
mousegetpos, xx, yy
  xx:=ok.1.1, yy:=ok.1.2, w:=ok.1.3, h:=ok.1.4
  mousemove, xx-6, aY+0
;click left
}
not really sure how to save the x coordinates from the middle of images
(this is with the new code and include command not the old script)

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 Jul 2022, 16:15

maxkill wrote:
21 Jul 2022, 12:39
Only think I noticed this include method is that it seems slightly slower, is it because I don't have the findtext file in the lib folder?
it’s slower because I put four Zeros ( 0,0,0,0 ) in the search area. How many monitors do you have? How big is your screen?

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

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

Post by maxkill » 21 Jul 2022, 18:09

SteveMylo wrote:
21 Jul 2022, 16:15
maxkill wrote:
21 Jul 2022, 12:39
Only think I noticed this include method is that it seems slightly slower, is it because I don't have the findtext file in the lib folder?
it’s slower because I put four Zeros ( 0,0,0,0 ) in the search area. How many monitors do you have? How big is your screen?
I use 4k screen but I only search in this case in the area provided in the script .. I managed to fix the function through dividing the 2 x coordinates from images found

Code: Select all

MouseGetPos, aX, aY
Mousegetpos, xx, yy
CoordMode, Mouse, Screen
Text:="|<>*imgtext1----"

if (ok:=FindText(xx-200, yy+2400, xx, yy+100, 0, 0, Text)) ; 150 can be adjusted by yourself

{
  xx:=ok.1.1, yy:=ok.1.2, w:=ok.1.3, h:=ok.1.4
;xx coordinates saved img1
}

mousegetpos, xx1, yy
Text:="|<>*imgtext2----"

if (ok:=FindText(xx1+200, yy+2400, xx1, yy+100, 0, 0, Text)) ; 150 can be adjusted by yourself
{

xx1:=ok.1.1, yy:=ok.1.2, w:=ok.1.3, h:=ok.1.4
;xx1 coordinates saved img2 
MidPt := (xx + xx1) / 2
mousemove, MidPt+1, aY+0
But it's nice if you can provide a smoother code aswell :idea:

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 Jul 2022, 19:23

maxkill wrote:
21 Jul 2022, 13:17
not really sure how to save the x coordinates from the middle of images
The answer is right there in front of you in my script.
The middle of the x coordinates is ((ok[1].x + ok[2].x) / 2).
So if you don't want a messy X value, then create a Variable. middleX := ((ok[1].x + ok[2].x) / 2)
*Also note that the X & Y in the below code if (ok:=FindText(X, Y, 0, 0, A_ScreenWidth, A_ScreenHeight, 0, 0, Text)) is the position of the 1st image found. Which in this case you don't need.
** Also with the new FindTEXT function you have, you don't need this clutter ===> xx:=ok.1.1, yy:=ok.1.2, w:=ok.1.3, h:=ok.1.4

Code: Select all

q::
MouseGetPos, xx, yy
Text:="|<>*imgtext1----"
Text.="|<>*imgtext2----"
if (ok:=FindText(X, Y, 0, 0, A_ScreenWidth, A_ScreenHeight, 0, 0, Text))  ; <== you can (Plus + or Minus -) anything from the search range as you know, e.g. (A_ScreenHeight /2)  or (A_ScreenHeight - yy) etc etc. You get the gist obviously. 
 ;~  ====> (pasted here just for reference)  ====>   MouseClick, Left, ((ok[1].x + ok[2].x) / 2), ((ok[1].y + ok[2].y ) / 2), 1, 1 
middleX := ((ok[1].x + ok[2].x) / 2)  
{
	MouseMove, middleX, yy, 1
}
return

Post Reply

Return to “Scripts and Functions (v1)”