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

Constructors

Properties

config: ScreenConfig = ...

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>

  • colorAt returns RGBA color values for a certain pixel at Point p

    Parameters

    • point: Point | Promise<Point>

      Location to query color information from

    Returns Promise<RGBA>

  • find will search for a single occurrence of a given search input on a systems main screen

    Type Parameters

    • PROVIDER_DATA_TYPE

    Parameters

    • searchInput: RegionResultFindInput | Promise<RegionResultFindInput>

      A FindInput instance

    • Optional params: OptionalSearchParameters<PROVIDER_DATA_TYPE>

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

    Returns Promise<Region>

  • Type Parameters

    • PROVIDER_DATA_TYPE

    Parameters

    • searchInput: {
          by: {
              color: RGBA;
          };
          id: string;
          type: "color";
      } | Promise<{
          by: {
              color: RGBA;
          };
          id: string;
          type: "color";
      }>
    • Optional params: OptionalSearchParameters<PROVIDER_DATA_TYPE>

    Returns Promise<Point>

  • Type Parameters

    • PROVIDER_DATA_TYPE

    Parameters

    • searchInput: {
          by: {
              title: string | RegExp;
          };
          id: string;
          type: "window";
      } | Promise<{
          by: {
              title: string | RegExp;
          };
          id: string;
          type: "window";
      }>
    • Optional params: OptionalSearchParameters<PROVIDER_DATA_TYPE>

    Returns Promise<Window>

  • Type Parameters

    • PROVIDER_DATA_TYPE

    Parameters

    • searchInput: FindInput | Promise<FindInput>
    • Optional params: OptionalSearchParameters<PROVIDER_DATA_TYPE>

    Returns Promise<FindResult>

  • findAll will search for every occurrence of a given search input on a systems main screen

    Type Parameters

    • PROVIDER_DATA_TYPE

    Parameters

    • searchInput: RegionResultFindInput | Promise<RegionResultFindInput>

      A FindInput instance to search for

    • Optional params: OptionalSearchParameters<PROVIDER_DATA_TYPE>

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

    Returns Promise<Region[]>

  • Type Parameters

    • PROVIDER_DATA_TYPE

    Parameters

    • searchInput: {
          by: {
              color: RGBA;
          };
          id: string;
          type: "color";
      } | Promise<{
          by: {
              color: RGBA;
          };
          id: string;
          type: "color";
      }>
    • Optional params: OptionalSearchParameters<PROVIDER_DATA_TYPE>

    Returns Promise<Point[]>

  • Type Parameters

    • PROVIDER_DATA_TYPE

    Parameters

    • searchInput: {
          by: {
              title: string | RegExp;
          };
          id: string;
          type: "window";
      } | Promise<{
          by: {
              title: string | RegExp;
          };
          id: string;
          type: "window";
      }>
    • Optional params: OptionalSearchParameters<PROVIDER_DATA_TYPE>

    Returns Promise<Window[]>

  • grabRegion grabs screen content of a region on the systems main display

    Parameters

    • regionToGrab: Region | Promise<Region>

      The screen region to grab

    Returns Promise<Image>

  • 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 highlights a screen Region for a certain duration by overlaying it with an opaque highlight window

    Parameters

    • regionToHighlight: Region | Promise<Region>

      The Region to highlight

    Returns Promise<Region>

  • on registers a callback which is triggered once a certain searchInput image is found

    Parameters

    • searchInput: {
          by: {
              title: string | RegExp;
          };
          id: string;
          type: "window";
      }

      to trigger the callback on

      • by: {
            title: string | RegExp;
        }
        • title: string | RegExp
      • id: string
      • type: "window"
    • callback: WindowCallback

      The FindHookCallback function to trigger

    Returns void

  • Parameters

    • searchInput: {
          by: {
              color: RGBA;
          };
          id: string;
          type: "color";
      }
      • by: {
            color: RGBA;
        }
        • color: RGBA
      • id: string
      • type: "color"
    • callback: MatchResultCallback<Point>

    Returns void

  • Parameters

    Returns void

  • waitFor searches for a template image for a specified duration

    Type Parameters

    • PROVIDER_DATA_TYPE

    Parameters

    • searchInput: RegionResultFindInput | Promise<RegionResultFindInput>

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

    • Optional timeoutMs: number

      Timeout in milliseconds after which waitFor fails

    • Optional updateInterval: number

      Update interval in milliseconds to retry search

    • Optional params: OptionalSearchParameters<PROVIDER_DATA_TYPE>

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

    Returns Promise<Region>

  • Type Parameters

    • PROVIDER_DATA_TYPE

    Parameters

    • searchInput: {
          by: {
              color: RGBA;
          };
          id: string;
          type: "color";
      } | Promise<{
          by: {
              color: RGBA;
          };
          id: string;
          type: "color";
      }>
    • Optional timeoutMs: number
    • Optional updateInterval: number
    • Optional params: OptionalSearchParameters<PROVIDER_DATA_TYPE>

    Returns Promise<Point>

  • Type Parameters

    • PROVIDER_DATA_TYPE

    Parameters

    • searchInput: {
          by: {
              title: string | RegExp;
          };
          id: string;
          type: "window";
      } | Promise<{
          by: {
              title: string | RegExp;
          };
          id: string;
          type: "window";
      }>
    • Optional timeoutMs: number
    • Optional updateInterval: number
    • Optional params: OptionalSearchParameters<PROVIDER_DATA_TYPE>

    Returns Promise<Window>

  • 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>