AcceleratorRecognition Property

Applies to TestComplete 15.70, last modified on December 17, 2024
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.

Description

The OCROptions.AcceleratorRecognition property lets you specify whether underlined characters should be recognized as accelerators or not.

Declaration

OCROptionsObj.AcceleratorRecognition

Read-Write Property Boolean
OCROptionsObj An expression, variable or parameter that specifies a reference to an OCROptions object

Applies To

The property is applied to the following object:

Property Value

True if the accelerator recognition is used. False if the accelerator recognition is not used.

Example

The following example obtains an image of the Notepad window and recognizes the text with using the accelerator recognition. After that, it posts the recognized text to the test log.

JavaScript, JScript

function OCROptionsSample()
{
  var notepad, Window, Rect, OCRObj, OCROptions;
  // 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 accelerator recognition will be used
  OCROptions.AcceleratorRecognition = true;
  // Recognizes the text and posts it to the test log
  Log.Message("Recognized text:", OCRObj.GetText(OCROptions));

}

Python

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 accelerator recognition will be used
  OCROptions.AcceleratorRecognition = True
  # Recognizes the text and posts it to the test log
  Log.Message("Recognized text:", OCRObj.GetText(OCROptions))

VBScript

Sub OCROptionsSample

  ' Obtains the Notepad window
  Set notepad = Sys.Process("notepad")
  Set Window = notepad.Window("Notepad", "*").Window("Edit")
  ' Captures an image of the Notepad window
  Set Rect = Window.Picture
  Call Log.Picture(Rect, "Region with the text to be recognized")

  ' Creates an OCR object
  Set OCRObj = OCR.CreateObject(Rect)
  ' Creates an OCROptions object
  Set OCROptions = OCRObj.CreateOptions

  ' Specifies that the accelerator recognition will be used
  OCROptions.AcceleratorRecognition = True
  ' Recognizes the text and posts it to the test log
  Call Log.Message("Recognized text:", OCRObj.GetText(OCROptions))

End Sub

DelphiScript

procedure OCROptionsSample();
var notepad, Window, Rect, OCRObj, OCROptions : OleVariant;
begin
  // 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 accelerator recognition will be used
  OCROptions.AcceleratorRecognition := true;
  // Recognizes the text and posts it to the test log
  Log.Message('Recognized text:', OCRObj.GetText(OCROptions));

end;

C++Script, C#Script

function OCROptionsSample()
{
  var notepad, Window, Rect, OCRObj, OCROptions;
  // 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 accelerator recognition will be used
  OCROptions["AcceleratorRecognition"] = true;
  // Recognizes the text and posts it to the test log
  Log["Message"]("Recognized text:", OCRObj["GetText"](OCROptions));

}

See Also

Optical Character Recognition
Using Optical Character Recognition - Tips

Highlight search results