Description
7.4.X and later versions
The new OCR function WaitWndOcr brings a lot of functionality coparing to the WaitAppStrOcr function. For example, it can click on a particular string found. It complements the WaitSearchBitmap function. Our pre-requisites recommend to have a resolution of 1280x1024 on your Newtest robots. This does not mean that the new WaitWndOCR function does not work in 1024x768, but it improves the results with better resolution.
Parameter(s)
The assistant is started with a right click in a Windows or NewtRIA script:

Among the OCR core parameters, the following are important:
- Language and caracters: use the appropriate settings when looking for dictionnary words (e.g. Login) or acronyms (e.g. application name like SUPERAPP).

Recommended settings: do not use lower/uppercase sensitivity
- Resolution enhancement ("OCR.RESOLUTIONENHANCEMENT"): use 'yes' to convert to a higher resolution image

A screen resoution of 1024*768 is only 96DPI, which is low compared to Scanner applications (>300 DPI usually) used for OCR. Therefore, it may be required to increase artificially the resolution for better analysis input.
Recommended settings: leave 'auto'
- Image conversion: this step prepares an homogeneous zone for running the analysis

Recommended settings: leave 'auto'
- Check period ("OCR.PERIOD"): OCR scan refresh rate. Do not decrease this value too much in order not to overuse CPU resources

Recommended settings: 200ms
- Capture delay("WINDOW.CAPTURE_DELAY"): delay before first screen capture (once)

Recommended settings: 100ms

Note: this option does not allow fo clicking
- The 'Light' regular expression allows for simple 'wildcards' when searching for text strings:

With this mode, it is also possible to click on the found text. Only the following 'wildcards' are possible:
- *: one or none caracter (for example 'ip*label' finds 'ip-label' or 'iplabel')
- ?: at least one caracter (for example 'ip?label' finds 'ip-label' but not 'iplabel')
- [abc] : means the characters a, b or c (for example 'ip[-_]label' finds 'ip-label' or 'ip_label')
- \ : escape character (for example to use a special caracter like '*' or '?' in your search)
- | : OR (for example "ip[-_]label|newtest" <=> find "ip[-_]label" or "newtest")
- OCR zone offset (advanced): In order to resue the previous zone where the text was found, use a relative position: SetArgString("OCR.OFFSETS","10,10 :50,50").
Example(s)
Seeing the OCR analysis results
You can print the variable $(OCR.RESULT)
in a TraceInfo or write the outcome by any other mean (text file...)
Warning: Do not use the variable $(OCR.RESULT)
in a loop: its value will not change during the iterations. For use in a loop, you must use the function GetArgString:
reference to undefined name 'syntax' Une exception de type 'MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException' a été levée. (click for details)Callstack:
at NEWTEST/NTBR_-_Newtest_Transaction_Builder/Scripting/Newtest_Basic_functions/WaitWndOCR
MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException: reference to undefined name 'syntax' Une exception de type 'MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException' a été levée.
à MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit(DekiScriptVar expr, DekiScriptExpressionEvaluationState state)
à MindTouch.Deki.Script.Expr.DekiScriptVar.VisitWith[TState,TReturn](IDekiScriptExpressionVisitor`2 visitor, TState state)
à MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Evaluate(DekiScriptAccess expr, DekiScriptExpressionEvaluationState state, Boolean evaluateProperties)
à MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit(DekiScriptAccess expr, DekiScriptExpressionEvaluationState state)
à MindTouch.Deki.Script.Expr.DekiScriptAccess.VisitWith[TState,TReturn](IDekiScriptExpressionVisitor`2 visitor, TState state)
à MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit(DekiScriptCall expr, DekiScriptExpressionEvaluationState state)
à MindTouch.Deki.Script.Expr.DekiScriptCall.VisitWith[TState,TReturn](IDekiScriptExpressionVisitor`2 visitor, TState state)
à MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit(DekiScriptSequence expr, DekiScriptExpressionEvaluationState state)
à MindTouch.Deki.Script.Expr.DekiScriptSequence.VisitWith[TState,TReturn](IDekiScriptExpressionVisitor`2 visitor, TState state)
à MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit(DekiScriptReturnScope expr, DekiScriptExpressionEvaluationState state)
reference to undefined name 'syntax' Une exception de type 'MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException' a été levée. (click for details)Callstack:
at NEWTEST/NTBR_-_Newtest_Transaction_Builder/Scripting/Newtest_Basic_functions/WaitWndOCR
MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException: reference to undefined name 'syntax' Une exception de type 'MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException' a été levée.
à MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit(DekiScriptVar expr, DekiScriptExpressionEvaluationState state)
à MindTouch.Deki.Script.Expr.DekiScriptVar.VisitWith[TState,TReturn](IDekiScriptExpressionVisitor`2 visitor, TState state)
à MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Evaluate(DekiScriptAccess expr, DekiScriptExpressionEvaluationState state, Boolean evaluateProperties)
à MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit(DekiScriptAccess expr, DekiScriptExpressionEvaluationState state)
à MindTouch.Deki.Script.Expr.DekiScriptAccess.VisitWith[TState,TReturn](IDekiScriptExpressionVisitor`2 visitor, TState state)
à MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit(DekiScriptCall expr, DekiScriptExpressionEvaluationState state)
à MindTouch.Deki.Script.Expr.DekiScriptCall.VisitWith[TState,TReturn](IDekiScriptExpressionVisitor`2 visitor, TState state)
à MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit(DekiScriptSequence expr, DekiScriptExpressionEvaluationState state)
à MindTouch.Deki.Script.Expr.DekiScriptSequence.VisitWith[TState,TReturn](IDekiScriptExpressionVisitor`2 visitor, TState state)
à MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit(DekiScriptReturnScope expr, DekiScriptExpressionEvaluationState state)
Comments