Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Hierarchy

  • ScreenClass

Index

Constructors

constructor

Properties

config

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

Config object for ScreenClass class

Type declaration

  • autoHighlight: boolean
  • confidence: number
  • highlightDurationMs: number
  • highlightOpacity: number
  • resourceDirectory: string

Methods

capture

  • capture(fileName: string, fileFormat?: FileType, filePath?: string, fileNamePrefix?: string, fileNamePostfix?: string): Promise<string>
  • capture captures a screenshot of a systems main display

    Parameters

    • fileName: string

      Basename for the generated screenshot

    • fileFormat: FileType = ...

      The FileType for the generated screenshot

    • filePath: string = ...

      The output path for the generated screenshot (Default: {@link 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

  • captureRegion(fileName: string, regionToCapture: Region | Promise<Region>, fileFormat?: FileType, filePath?: string, fileNamePrefix?: string, fileNamePostfix?: string): 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 = ...

      The FileType for the generated screenshot

    • filePath: string = ...

      The output path for the generated screenshot (Default: {@link cwd})

    • fileNamePrefix: string = ""

      Filename prefix for the generated screenshot (Default: empty)

    • fileNamePostfix: string = ""

      Filename postfix for the generated screenshot (Default: empty)

    Returns Promise<string>

colorAt

find

  • find will search for a single occurrence of a template image on a systems main screen

    Parameters

    • template: Image | Promise<Image>

      Template Image instance

    • Optional params: OptionalSearchParameters

      {@link LocationParameters} which are used to fine tune search region and / or match confidence

    Returns Promise<Region>

findAll

grab

grabRegion

height

  • height(): Promise<number>
  • 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>

highlight

on

waitFor

  • waitFor searches for a template image for a specified duration

    Parameters

    • templateImage: Image | Promise<Image>

      Filename of the template image, relative to {@link 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

      {@link LocationParameters} which are used to fine tune search region and / or match confidence

    Returns Promise<Region>

width

  • width(): Promise<number>
  • 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>