Options
All
  • Public
  • Public/Protected
  • All
Menu

Screen aptitude allows Loops to enable Optical character recognition ability.

Hierarchy

  • Screen

Index

Methods

  • compareHash(hashA: string, hashB: string): Promise<number>
  • experimental

    This functionality is experimental and subject to breaking changes. Returns the hamming distance between the two hashes. The more the hashes differ, the larger the distance will be. If the hashes are equal, the distance will be 0.

    Parameters

    • hashA: string

      The first hash to compare

    • hashB: string

      The second hash to compare

    Returns Promise<number>

    A promise with the hamming distance from hashA to hashB

  • hash(bounds: Bounds, sensitivity: number, hashType?: HashType): Promise<string>
  • experimental

    This functionality is experimental and subject to breaking changes. Calculates the image hash of the specified screen area using the specified hash algorithm

    Parameters

    • bounds: Bounds

      The area on the screen where to take the hash.

    • sensitivity: number

      Controls the hash size. Larger hash sizes will be more sensitive to changes. Exceeding a value of 3 will result in a very slow calculation and is not recommended. Must be a positive integer.

    • Optional hashType: HashType

    Returns Promise<string>

    A promise resolving with the hash of the selected area

  • listenHash(bounds: Bounds, threshold: number, delayMs: number, sensitivity: number, hashType: HashType, callback: (distance: number) => void): Promise<Cancellable>
  • experimental

    This functionality is experimental and subject to breaking changes. Monitors the specified screen area for changes. The callback is called when a change is detected. The screen is considered different when the distance between subsequent hashes exceeds the provided threshold.

    Parameters

    • bounds: Bounds

      The area on the screen to monitor for changes

    • threshold: number

      The distance between subsequent hashes required to trigger the callback. Must be a positive integer.

    • delayMs: number

      The delay in milliseconds between checks. Must be a positive integer.

    • sensitivity: number

      -controls the hash size. Larger hash sizes will be more sensitive to changes. Exceeding a value of 3 will result in a very slow calculation and is not recommended. Must be a positive integer.

    • hashType: HashType

      Specifies the type of hash to use

    • callback: (distance: number) => void

      The function called when the distance between hashes results in a value higher than the specified threshold value.

        • (distance: number): void
        • Parameters

          • distance: number

          Returns void

    Returns Promise<Cancellable>

  • experimental

    This functionality is experimental and subject to breaking changes. listenOcrMonitor listens to active window changes. This function provides active window recognition on the backend.

    Parameters

    Returns Promise<Cancellable>

  • listenPixelDiff(bounds: Bounds, threshold: number, delayMs: number, callback: (difference: number) => void): Promise<Cancellable>
  • experimental

    This functionality is experimental and subject to breaking changes. Monitors the specified screen area for changes. The callback is called when a change is detected. The screen is considered different when the distance between subsequent hashes exceeds the provided threshold. This counts the number of differences in the image by pixel component. The returned difference is a number between 0 and 1. A difference of 0 means the images are the same. A difference of 1 means the images are entirely different.

    Parameters

    • bounds: Bounds

      The area on the screen to monitor for changes

    • threshold: number

      The required difference to trigger the callback. Ranges from 0-1.

    • delayMs: number

      The delay in milliseconds between checks. Must be a positive integer.

    • callback: (difference: number) => void

      The function to call when a change is detected

        • (difference: number): void
        • Parameters

          • difference: number

          Returns void

    Returns Promise<Cancellable>

  • listenPixelDiffActiveWindow(threshold: number, delayMs: number, callback: (difference: number) => void): Promise<Cancellable>
  • experimental

    This functionality is experimental and subject to breaking changes. Monitors the active window for changes. The callback is called when a change is detected. The screen is considered different when the distance between subsequent hashes exceeds the provided threshold. This counts the number of differences in the image by pixel component. The returned difference is a number between 0 and 1. A difference of 0 means the images are the same. A difference of 1 means the images are entirely different.

    Parameters

    • threshold: number

      The required difference to trigger the callback. Rnages from 0-1.

    • delayMs: number

      The delay in milliseconds between checks. Must be a positive integer.

    • callback: (difference: number) => void

      The function to call when a change is detected

        • (difference: number): void
        • Parameters

          • difference: number

          Returns void

    Returns Promise<Cancellable>

  • Performs screen OCR and returns recognized text ressults.

    Parameters

    Returns Promise<OCRResult[]>

    A Promise resolving with the text results as a string.

  • ocrFileEncoded(encodedFileString: string): Promise<OCRResult[]>
  • It takes a base64 encoded string from reading the image file

    Parameters

    • encodedFileString: string

      The string of Base64 encoded image

    Returns Promise<OCRResult[]>

    A Promise resolving with the text results as a string.

Generated using TypeDoc