Recognize text on the screen, click or wait for text to appear/disappear
Text Recognition
is pretty much the same as Image Detection.
Rather than searching for an image in Region
, we search for a text.
Image is compared by pixels (color, intensity, etc...). Text is compared letters by letters.
You have extra parameters when text is selected as the Template
.
The in-app tutorial explain this quite thoroughly.
After the OCR engine read the screen. We can specify how the text should be segmented: by Word, Line or Paragraph
For example we have this text on the screen:
The quick browns fox
jump over the lazy dog
And the Template
is "fox"
In this case we should make our template a full line instead of just the word "fox" because it only has 3 letters. If one letter is misread for example "o" can be read as 0 zero, then the match score is only 2/3 or 67% which is below the default Min Score
. More letters == better accuracy.
Disallow or allow some characters. "l" sometimes might be read of 1, "o" might be read as 0. Set this correctly will increase the accuracy of OCR Engine.
For example, if you only expect number then you can set whitelist to 0123456789
By default, text compare is case insensitive. Check this to enable case sensitive compare.
//Create a Region
var region = Region(100, 100, 500, 500)
//The only difference here is rather than calling click we call clickText
var match = region.clickText("the text", FParam.timeout(3000).sRate(2).mScore(0.8))
if (match) {
//Success
} else {
//Fail
}
© 2024 - Macrorify by KoK-CODE