Invalid Bitmap using Legacy OCR
I have a number of application fields (Uniface unitext), They contain text but Testcomplete does not expose the wText (It appears unable to recognose any of the field content, although all properties exist, no content is exposed), As my environemt is secure (no external access) I am unable to exploit the IQ addon, my options are Text Recognition or OCR, Text Recognition does not appear to work with Uniface (A search for known text on screen returns nothing!) My hope hangs on Legacy OCR however when calling Set octObj = OCR.CreateObject(picObj) I get a runtime error Invalid Bitmap.
I know which UniText field I need to interigate by its .top and .left properties, All I am trying to do is produce a nice clean checkpoint in the log file!
picObj is set to FormObj.Windows("UniText","",19).picture
log.picture picObj, "Image to Ocr"
Is producing a very nice logged picture of the UniText field in this case its a duration ie 12345:12
Am I missing something here? is the deafult object.picture not a bitmap?
My hope was to do something like
Set FormObj = Incredibly long uniface path to unicanvas containing the objects of interest...
picObj = FormObj.Windows("UniText","",VarIndex).picture
log.picture picObj, "Image to Ocr"
Set ocrObj = OCR.CreateObject(picObj)
ocrText = ocrObj.GetText()
if ocrText = varExpValue then
log.checkpoint "Checkpoint passed " & ocrText
else
log.error "Checkpoint failed value " & ocrText & ", expected " & varExpValue
runner.stop
End if
Set ocrObj = Nothing
Set FormObj = Nothing
I am allready checkpointing the data via a direct database read, so I know the retrieved value should be ok, however I really want to check the screen value presented to users...
Hi,
> picObj = FormObj.Windows("UniText","",VarIndex).picture
Unless it is a typo in the post, picObj must be Set :
Set picObj = FormObj.Windows("UniText","",VarIndex).picture
Does this help?
Otherwise, I did not spot anything wrong in your code sample and you may ask Support directly via the https://support.smartbear.com/message/?prod=TestComplete form.
One more possible approach is to:
-- select all text in a field;
-- copy it to the clipboard (via the <obj>.Keys("^c") call)
-- assign to script variable (e.g. aFieldVal = Sys.Clipboard);
-- use this script variable for checkpoint.
Note: as clipboard is a shared resource, it is recommended to assign its value to the script variable as soon as possible to avoid possible overwrite.