|This property is provided by the legacy OCR plugin. In version 12.60, the plugin was replaced with the new Optical Character Recognition plugin powered by Google Cloud Vision API. To learn more, see Optical Character Recognition.
The legacy OCR plugin was removed from TestComplete in version 12.60. If you need to use objects, methods, and properties provided by the legacy plugin with this version of TestComplete, please contact our Customer Care team. The legacy OCR plugin was restored in TestComplete version 14.0. To use the objects, methods, and properties with this or later TestComplete version, you need to install and enable the plugin manually.
OCROptions.SearchAccuracy property defines a numerical representation of how much the recognized string should match the string passed to the
OCRObject.FindRectByText method in order to consider them as identical. This property is used only when the
OCROptions.ExactSearch property is set to False.
To learn more about character recognition in TestComplete, see Using Optical Character Recognition.
|OCROptionsObj||An expression, variable or parameter that specifies a reference to an OCROptions object|
The property is applied to the following object:
A real value ranging from 0 to 1 that denotes the accuracy of string comparison. If
SearchAccuracy is set to 1, the exact string matches will be sought. The default value of this property is 0.6.
The following example uses the
OCROptions object to specify that the
OCRobject.FindRectByText method will not use the exact search and sets the search accuracy to 0.3. After that, it searches for the "Test" string within the text written in Windows Notepad by using the specified OCR options. The rectangle containing the found text is posted to the test log.
def OCROptionsSample(): # Obtains the Notepad window notepad = Sys.Process("notepad") Window = notepad.Window("Notepad", "*").Window("Edit") # Captures an image of the Notepad window Rect = Window.Picture() Log.Picture(Rect, "Region with the text to be recognized") # Creates an OCR object OCRObj = OCR.CreateObject(Rect) # Creates an OCROptions object OCROptions = OCRObj.CreateOptions() # Specifies that the FindRectByText method will not search for exact matches OCROptions.ExactSearch = False # Specifies the comparison accuracy OCROptions.SearchAccuracy = 0.3 # Searches for the rectangle that contains the "Test" string FindResult = OCRObj.FindRectByText("Test", OCROptions) if FindResult: # Obtains the coordinates and the size of the found rectangle X = OCRObj.FoundLeft Y = OCRObj.FoundTop dX = OCRObj.FoundWidth dY = OCRObj.FoundHeight RectResult = Window.Picture(X, Y, dX, dY) # Posts the found rectangle to the test log Log.Picture(RectResult, "Region with the found text:")