|This object 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 object is used to configure settings that affect how optical character recognition in the visible area of the onscreen object will be performed. To get the
OCROptions object, call the
The following code snippet creates an
OCROptions object that contains the default character recognition settings and then posts those default settings to the test log.
def OCROptionsSample(): # ... # Obtains an image of an on-screen object Rect = OnScreenObj.Picture() # Creates an OCR object OCRObj = OCR.CreateObject(Rect) # Creates an OCROptions object that stores the default character recognition settings OCROptions = OCRObj.DefaultOptions # Obtains the default settings and posts them to the test log Info = "Active recognition set: " + str(OCROptions.ActiveRecognitionSet) + "\r\n" + "Grayscale binarization: " + str(OCROptions.GrayScaleBinarization) + "\r\n" + "Binarization threshold: " + str(OCROptions.BinarizationThreshold) + "\r\n" + "Recognition autorejection: " + str(OCROptions.RecognitionRejectionAuto) + "\r\n" + "Recognition rejection threshold: " + str(OCROptions.RecognitionRejection) + "\r\n" + "Exact search is used: " + str(OCROptions.ExactSearch) + "\r\n" + "Search accuracy threshold: " + str(OCROptions.SearchAccuracy) + "\r\n" + "Skip fragmentation: " + str(OCROptions.SkipFragmentation) Log.Message("Character Recognition Default Settings", Info) # Obtains the collection of fonts used for character recognition # And posts them to the test log Fonts = OCROptions.Fonts Count = Fonts.Count Log.AppendFolder("Fonts used for character recognition:") for i in range(0, Count): Log.Message(Fonts.Item[i].Name) Log.PopLogFolder()