ScreenClass class provides methods to access screen content of a systems main display

Hierarchy

  • ScreenClass

Constructors

Properties

config: { autoHighlight: boolean; confidence: number; highlightDurationMs: number; highlightOpacity: number; resourceDirectory: string } = ...

Config object for ScreenClass class

Type declaration

  • autoHighlight: boolean

    Configure whether to auto highlight all search results or not

  • confidence: number

    Configures the required matching percentage for template images to be declared as a match

  • highlightDurationMs: number

    Configure highlighting duration

  • highlightOpacity: number

    Configure opacity of highlight window

  • resourceDirectory: string

    Configures the path from which template images are loaded from

Methods

  • capture captures a screenshot of a systems main display

    Parameters

    • fileName: string

      Basename for the generated screenshot

    • fileFormat: FileType = FileType.PNG

      The FileType for the generated screenshot

    • filePath: string = ...

      The output path for the generated screenshot (Default: cwd)

    • fileNamePrefix: string = ""

      Filename prefix for the generated screenshot (Default: empty)

    • fileNamePostfix: string = ""

      Filename postfix for the generated screenshot (Default: empty)

    Returns Promise<string>

  • captureRegion captures a screenshot of a region on the systems main display

    Parameters

    • fileName: string

      Basename for the generated screenshot

    • regionToCapture: Region | Promise<Region>

      The region of the screen to capture in the screenshot

    • fileFormat: FileType = FileType.PNG

      The FileType for the generated screenshot

    • filePath: string = ...

      The output path for the generated screenshot (Default: cwd)

    • fileNamePrefix: string = ""

      Filename prefix for the generated screenshot (Default: empty)

    • fileNamePostfix: string = ""

      Filename postfix for the generated screenshot (Default: empty)

    Returns Promise<string>

  • height returns the main screen height This refers to the hardware resolution. Screens with higher pixel density (e.g. retina displays in MacBooks) might have a higher height in in actual pixels

    Returns Promise<number>

  • waitFor searches for a template image for a specified duration

    Parameters

    • templateImage: Image | Promise<Image>

      Filename of the template image, relative to ScreenClass.config.resourceDirectory, or an Image

    • timeoutMs: number = 5000

      Timeout in milliseconds after which waitFor fails

    • updateInterval: number = 500

      Update interval in milliseconds to retry search

    • Optional params: OptionalSearchParameters

      LocationParameters which are used to fine tune search region and / or match confidence

    Returns Promise<Region>

  • width returns the main screen width This refers to the hardware resolution. Screens with higher pixel density (e.g. retina displays in MacBooks) might have a higher width in in actual pixels

    Returns Promise<number>