As far as library, I was referring to this in the posts? Is this something necessary for OCR and findtext()?
Code: Select all
FindTextOCR(nX, nY, nW, nH, err1, err0, Text, Interval=20)
{
OCR:="", RightX:=nX+nW-1
While (ok:=FindText(nX, nY, nW, nH, err1, err0, Text))
{
; For multi text search, This is the number of text images found
For k,v in ok
{
; X is the X coordinates of the upper left corner
; and W is the width of the image have been found
x:=v.1, y:=v.2, w:=v.3, h:=v.4, comment:=v.5
; We need the leftmost X coordinates
if (A_Index=1 or x<LeftX)
LeftX:=x, LeftY:=y, LeftW:=w, LeftH:=h, LeftOCR:=comment
else if (x=LeftX)
{
Loop, 100
{
err:=A_Index/100
if FindText(x, y, w, h, err, err, Text)
{
LeftX:=x, LeftY:=y, LeftW:=w, LeftH:=h, LeftOCR:=comment
Break
}
if FindText(LeftX, LeftY, LeftW, LeftH, err, err, Text)
Break
}
}
}
; If the interval exceeds the set value, add "*" to the result
OCR.=(A_Index>1 and LeftX-nX-1>Interval ? "*":"") . LeftOCR
; Update nX and nW for next search
nX:=LeftX+LeftW-1, nW:=RightX-nX+1
}
return, OCR
}