Show / Hide Table of Contents

Method ocrFinder.Exists(+ 1 overload)


Overload

Performs OCR (text recognition) and finds text in results.

public bool Exists(IFArea area)
Parameters
area  (IFArea)

On-screen area or image:

  • wnd - window or control (its client area).
  • elm - UI element.
  • System.Drawing.Bitmap - image.
  • RECT - a rectangle area in screen.
  • IFArea - can contain wnd, elm or Bitmap. Also allows to specify a rectangle in it, which makes the area smaller and the function faster. Example: new(w, (left, top, width, height)).
Returns
bool

If found, sets ocrFinder.Result and returns true, else false.

Exceptions
AuWndException

Invalid window handle (the area argument).

ArgumentException

An argument is/contains a null/invalid value.

AuException

Something failed.

Remarks

The function captures image from screen or window (unless area is Bitmap) and passes it to the OCR engine (calls IOcrEngine.Recognize). Then finds the specified text in results. If found, creates and returns an ocr object that contains results.

The speed depends on engine, area size and amount of text.


Overload(top)

Performs OCR (text recognition) and finds text in results. Can wait and throw NotFoundException.

public bool Exists(IFArea area, Seconds wait)
Parameters
area  (IFArea)

On-screen area or image:

  • wnd - window or control (its client area).
  • elm - UI element.
  • System.Drawing.Bitmap - image.
  • RECT - a rectangle area in screen.
  • IFArea - can contain wnd, elm or Bitmap. Also allows to specify a rectangle in it, which makes the area smaller and the function faster. Example: new(w, (left, top, width, height)).
wait  (Seconds)

The wait timeout, seconds. If 0, does not wait. If negative, does not throw exception when not found.

Returns
bool

If found, sets ocrFinder.Result and returns true. Else throws exception or returns false (if wait negative).

Exceptions
NotFoundException
AuWndException

Invalid window handle (the area argument), or the window closed while waiting.

ArgumentException

An argument is/contains a null/invalid value.

AuException

Something failed.

Remarks

The function captures image from screen or window (unless area is Bitmap) and passes it to the OCR engine (calls IOcrEngine.Recognize). Then finds the specified text in results. If found, creates and returns an ocr object that contains results.

The speed depends on engine, area size and amount of text.