|This method 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.
OCRObject.CreateOptions method lets you get an
OCROptions object used to configure character recognition settings for an onscreen object.
|OCRObjectObj||An expression, variable or parameter that specifies a reference to an OCRObject object|
The method is applied to the following object:
To obtain the
OCROptions object that holds the default recognition settings, use the
The following code snippet captures an image of an on-screen object and creates an
OCRObject object. After that, it creates an
OCROptions object that contains OCR settings, modifies the settings and uses them to recognize the text. The recognized text is posted to the test log.
def OCROptionsSample(): # Obtains an on-screen object and captures an image of it notepad = Sys.Process("notepad") Window = notepad.Window("Notepad", "*").Window("Edit") 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() # Modifies the OCR options OCROptions.ActiveRecognitionSet = 4 OCROptions.ExactSearch = False OCROptions.SearchAccuracy = 0.4 # Recognizes the text using the specified settings # Posts the recognized text to the test log Log.Message("Found text:", OCRObj.GetText(OCROptions))