OCR which  might be the last choice for identify object/text in screen in TestComplete.
Open OCR sample  at,
C:\Program Files\Automated  QA\TestComplete 5\Samples\Scripts\OCR\OCR.pjs
Just run  it.
There are 2 parts of code, but below  is the key point,
   TextToFind = "E-mail";
  Pic  = wOfficeListBox.Picture(0, 0, wOfficeListBox.Width, wOfficeListBox.Height,  false);  
  OCRObjList  = OCR.CreateObject(Pic);
  FindRes  = OCRObjList.FindRectByText(TextToFind);  
The only part you need to replace is  Pic  = wOfficeListBox.Picture(0, 0, wOfficeListBox.Width, wOfficeListBox.Height,  false);
You could use  the way in this sample if you could get the object, otherwise you could always  use Sys.Desktop.ActiveWindow() to get the window snapshot and specify the  coordinates of the area you care, and do the OCR, the recognition speed is  good.
And check TestComplete Help for topic “Recognition Tips” to know which area is better for your case.
No comments:
Post a Comment