Code: Select all
If ok:=FindText(outX, outY,574,1092,1107,1387,,,Text)
{
X:=ok.1, Y:=ok.2, W:=ok.3, H:=ok.4, Comment:=ok.5
FindText().ScreenToWindow(newX, newY, outX, outY, WinExist("A"))
ControlClick,x%newX% y%newY%, A,,,,NA
}
Code: Select all
If ok:=FindText(outX, outY,574,1092,1107,1387,,,Text)
{
X:=ok.1, Y:=ok.2, W:=ok.3, H:=ok.4, Comment:=ok.5
FindText().ScreenToWindow(newX, newY, outX, outY, WinExist("A"))
ControlClick,x%newX% y%newY%, A,,,,NA
}
Code: Select all
Text:="|<>*85$30.s1skwztsswztsswzsswtz1swNQ9syNMtsyPNtsy3Ntsz7slsz7U"
if (ok:=FindText(X:="wait1", Y:=30, 0, 0, A_ScreenWidth, A_ScreenHeight, 0, 0, Text))
{
FindText().Click(X, Y, "L")
}
"wait1" simply slaps FindText into a loop with 50ms sleep, and it works fine with my test scripts. Perhaps something in your full script is interfering with it somehow?Automata wrote: ↑30 May 2022, 05:13How to reduce delay of wait1? When text appear it takes around +10 seconds to actually detect that it appeared.If I simply slap FindText into loop with 100ms sleep then it finds inside 200-300ms. Would be much more convenient if wait1, wait 0 worked faster.Code: Select all
Text:="|<>*85$30.s1skwztsswztsswzsswtz1swNQ9syNMtsyPNtsy3Ntsz7slsz7U" if (ok:=FindText(X:="wait1", Y:=30, 0, 0, A_ScreenWidth, A_ScreenHeight, 0, 0, Text)) { FindText().Click(X, Y, "L") }
Thanks
My script is simple as it gets, what I get directly from findtext gui. Basically by default it finds my text in 60-300ms but if I add X:="wait1", Y:=30 then it takes +10 sec to find or many times even reaches timeout of 30sec.
Try writing it like this. I use this script (with my image) and it works instantly.... let me know if it works.
Code: Select all
Text:="|<>*85$30.s1skwztsswztsswzsswtz1swNQ9syNMtsyPNtsy3Ntsz7slsz7U"
FindText(X:="wait", Y:=30, 0,0,A_ScreenWidth,A_ScreenHeight, 0,0,Text)
if (ok:=FindText(X, Y, 0,0,A_ScreenWidth,A_ScreenHeight, 0, 0, Text))
{
FindText().Click(X, Y, "L")
}
return
~Esc::ExitApp
Still the same, taking enormous time to find.
Code: Select all
; Wait for the image to remain stable
While (ok:=this.FindText(OutputX, OutputY
, x1, y1, x2, y2, err1, err0, text, ScreenShot, FindAll
, JoinText, offsetX, offsetY, dir, zoomW, zoomH))
and (found)
{
v:=ok[1], x:=v[1], y:=v[2], w:=v[3], h:=v[4]
hash:=this.GetPicHash(x, y, x+w-1, y+h-1, 0)
Sleep, 10
if (hash=this.GetPicHash(x, y, x+w-1, y+h-1, 1))
return ok
}
Code: Select all
; Wait for the image to remain stable
While (ok:=this.FindText(OutputX, OutputY
, x1, y1, x2, y2, err1, err0, text, ScreenShot, FindAll
, JoinText, offsetX, offsetY, dir, zoomW, zoomH))
and (found)
{
v:=ok[1], x:=v[1], y:=v[2], w:=v[3], h:=v[4]
Sleep, 10
if this.FindText(0, 0, x, y, x+w-1, y+h-1
, err1, err0, text, ScreenShot, FindAll
, JoinText, offsetX, offsetY, dir, zoomW, zoomH)
return (this.ok:=ok)
}
Correct me if I'm wrong, but FindText works so fast, wouldn't you just do multiple scripts one after the other in different search regions?
Code: Select all
CoordMode, Mouse, Screen
x::
Text:="|<>*170$12.DwTyTzzzzzTzDyDsC0E0U"
if (ok:=FindText(X, Y, 87, 144, 169, 212, 0, 0, Text,,,,,,1)) ; small search range
{
FindText().Click(ok[1].x, ok[1].y, "L")
return ;; remove the 'return' if you want it to click on the next image too
}
Text:="|<>*165$11.D0zX1a382EAkNlVzUtU1U1U"
if (ok:=FindText(X, Y, 157, 205, 345, 305, 0, 0, Text,,,,,,1)) ;; 2nd small search range
{
FindText().Click(ok[1].x, ok[1].y, "L")
return
}
return
~Esc::ExitApp
This explains alot, I'm on my job pc.. this is probably why.