Currently I can find a graphic, the number 4, by using the following:
Code: Select all
#Include <FindText>
F1::
t1:=A_TickCount, Text:=X:=Y:=""
Text:="|<4>[b]50$6.66CCKqz66U"
if (ok:=FindText(X, Y, 1407-150000, 1196-150000, 1407+150000, 1196+150000, 0, 0, Text))
{
}
MsgBox, 4096, Tip, % "Found:`t" Round(ok.Length())
. "[c]n[/c]nTime:`t" (A_TickCount-t1) " ms"
. "[c]n[/c]nPos:`t" ok[1].x ", " ok[1].y
. "[c]n[/c]nResult:`t<" (Comment:=ok[1].id) ">"
for i,v in ok ; ok value can be get from ok:=FindText().ok
if (i<=2)
FindText().MouseTip(ok[i].x, ok[i].y)
I tried a test where I specified a very limited range of coordinates in if (ok:=FindText(X, Y,,,,, 0, 0, Text)) it was able to find it much faster 10ms. But using hardcoded coordinates is not ideal as I am constantly moving this window.
Reading the various articles for this library, I found there is a helper function for this exact need, FindText().WindowToScreen(outX2, outY2, 200, 300).
The help I was able to find on the function mentions:
my goal is to get the script to only look at the active windows body, when searching for a graphic>FindText().WindowToScreen(outX2, outY2, 200, 300) If ahk_id is not specified, then the active window will be used
But I am struggling to actually get a working example using my previous code:
Code: Select all
#Include <FindText>
F1::
t1:=A_TickCount, Text:=X:=Y:=""
Text:="|<4>[/b]50$6.66CCKqz66U"
;if (ok:=FindText(X, Y, 1407-150000, 1196-150000, 1407+150000, 1196+150000, 0, 0, Text))
;if (ok:=FindText(X, Y, outX2, outY2, 777, 236, 0, 0, Text).WindowToScreen(outX2, outY2, 777, 236))
if (ok:=FindText(outX2,outY2, , , , , 0, 0, Text).WindowToScreen(outX2, outY2, 775, 60))
{
}
MsgBox, 4096, Tip, % "Found:`t" Round(ok.Length())
. "[c]n[/c]nTime:`t" (A_TickCount-t1) " ms"
. "[c]n[/c]nPos:`t" ok[1].x ", " ok[1].y
. "[c]n[/c]nResult:`t<" (Comment:=ok[1].id) ">"
for i,v in ok ; ok value can be get from ok:=FindText().ok
if (i<=2)
FindText().MouseTip(ok[i].x, ok[i].y)
I am out of ideas here, so any help would be great. Thanks.