Version:
class

ScreenClass

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

typescript
class ScreenClass

Properties

NameTypeDescription
configScreenConfigConfig object for class(default: ...)

Methods

capture

capture(fileName: string, fileFormat?: FileType, filePath?: string, fileNamePrefix?: string, fileNamePostfix?: string): Promise<string>

captures a screenshot of a systems main display

Parameters

fileNamestringBasename for the generated screenshot
fileFormat?FileTypeThe for the generated screenshot
filePath?stringThe output path for the generated screenshot (Default: )
fileNamePrefix?stringFilename prefix for the generated screenshot (Default: empty)
fileNamePostfix?stringFilename postfix for the generated screenshot (Default: empty)

Returns

Promise<string>

colorAt

colorAt(point: Point | Promise<Point>): Promise<RGBA>

returns RGBA color values for a certain pixel at p

Parameters

pointPoint | Promise<Point>Location to query color information from

Returns

Promise<RGBA>

discardRecording

discardRecording(): Promise<void>

discards the current screen recording without saving.

Returns

Promise<void>

find

find(searchInput: RegionResultFindInput | Promise<RegionResultFindInput>, params?: OptionalSearchParameters<PROVIDER_DATA_TYPE>): Promise<Region>

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

Parameters

searchInputRegionResultFindInput | Promise<RegionResultFindInput>A instance
params?OptionalSearchParameters<PROVIDER_DATA_TYPE>which are used to fine tune search region and / or match confidence

Returns

Promise<Region>

findAll

findAll(searchInput: RegionResultFindInput | Promise<RegionResultFindInput>, params?: OptionalSearchParameters<PROVIDER_DATA_TYPE>): Promise<Region[]>

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

Parameters

searchInputRegionResultFindInput | Promise<RegionResultFindInput>A instance to search for
params?OptionalSearchParameters<PROVIDER_DATA_TYPE>which are used to fine tune search region and / or match confidence

Returns

Promise<Region[]>

grab

grab(): Promise<Image>

grabs screen content of a systems main display

Returns

Promise<Image>

height

height(): Promise<number>

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

highlight(regionToHighlight: Region | Promise<Region>): Promise<Region>

highlights a screen for a certain duration by overlaying it with an opaque highlight window

Parameters

regionToHighlightRegion | Promise<Region>The to highlight

Returns

Promise<Region>

on

on(searchInput: object, callback: WindowCallback): void

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

Parameters

searchInputobjectto trigger the callback on
callbackWindowCallbackThe function to trigger

startRecording

startRecording(options?: RECORDING_OPTIONS): Promise<void>

starts screen recording.

Parameters

options?RECORDING_OPTIONS

Returns

Promise<void>

startStreaming

startStreaming(options?: STREAMING_OPTIONS): Promise<void>

starts screen streaming.

Parameters

options?STREAMING_OPTIONS

Returns

Promise<void>

stopRecording

stopRecording(options?: STOP_RECORDING_OPTIONS): Promise<void>

stops screen recording.

Parameters

options?STOP_RECORDING_OPTIONS

Returns

Promise<void>

stopStreaming

stopStreaming(options?: STOP_STREAMING_OPTIONS): Promise<void>

stops screen streaming.

Parameters

options?STOP_STREAMING_OPTIONS

Returns

Promise<void>

waitFor

waitFor(searchInput: RegionResultFindInput | Promise<RegionResultFindInput>, timeoutMs?: number, updateInterval?: number, params?: OptionalSearchParameters<PROVIDER_DATA_TYPE>): Promise<Region>

searches for a template image for a specified duration

Parameters

searchInputRegionResultFindInput | Promise<RegionResultFindInput>Filename of the template image, relative to , or an
timeoutMs?numberTimeout in milliseconds after which fails
updateInterval?numberUpdate interval in milliseconds to retry search
params?OptionalSearchParameters<PROVIDER_DATA_TYPE>which are used to fine tune search region and / or match confidence

Returns

Promise<Region>

width

width(): Promise<number>

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>

Was this page helpful?