Forum Discussion

adamXpeter's avatar
Occasional Visitor
12 months ago

OCR.Recognize(Aliases.x.y.z).BlockByText("FindThis") unsets Aliases when "FindThis" is not found


Version: x64

What I have tried: I tried to find a row in a TDbGrid using OCR. The idea was to move the content via the vertical scrollbar if the text is not found till the last position is reached.

After hours of trying I have found how my script misteriously fails: after the OCR fails to find the text in this line:


myRecognizedText = OCR.Recognize(Aliases.EuroTC.dlgEllenor.pcEllenor.tsUfEll.nxgUfEll).BlockByText("10   Teszt");


where "10  Teszt" is initially not in the content area, Aliases turns into Value = "Aliases is not defined" in the Watch list, and the line

Aliases.EuroTC.dlgEllenor.pcEllenor.tsUfEll.nxgUfEll.VScroll.Pos = myPos

a bit later fails.


Why this happens?


PS: It would be cool if the debugger could catch exceptions just like the Delphi 7 debugger does (it catches even the handled ones). I had to surround it with try..catch to even get to know that an exception happened.