skrypton-api / com.waicool20.skrypton.sikulix / SKryptonScreen

SKryptonScreen

class SKryptonScreen : SKryptonRegion, IScreen

A class representing a IScreen that uses the given web view as its view port.

Constructors

<init>

SKryptonScreen(webView: SKryptonWebView)

Main constructor

Properties

clipboard

var clipboard: String

Independent clipboard bound to this screen.

keyboard

val keyboard: SKryptonKeyboard

Independent virtual keyboard bound to this screen.

mouse

val mouse: SKryptonMouse

Independent virtual mouse bound to this screen.

webView

val webView: SKryptonWebView

The web view that the screen is using as its view port.

Functions

capture

fun capture(): ScreenImage

Takes a screenshot of the whole screen.

fun capture(region: Region): ScreenImage
fun capture(x: Int, y: Int, width: Int, height: Int): ScreenImage
fun capture(rect: Rectangle): ScreenImage

Takes a screenshot of the screen.

currentMousePosition

fun currentMousePosition(): Location

Gets the current position of the virtual mouse.

getBounds

fun getBounds(): Rectangle

Returns the geometry of the underlying web view.

getID

fun getID(): Int

Returns the ID of the screen, in this case returns the underlying web view native pointer value.

getIdFromPoint

fun getIdFromPoint(srcx: Int, srcy: Int): Int

Gets the ID of a given point. Always 0 for a SKryptonScreen

getLastScreenImageFromScreen

fun getLastScreenImageFromScreen(): ScreenImage?

Returns the last saved screen image.

getRobot

fun getRobot(): IRobot

Gets the underlying robot instance used to control this screen.

showTarget

fun showTarget(location: Location): Unit

Highlights the given target.

userCapture

fun userCapture(): ScreenImage

Same as userCapture(null) (Use default prompt string)

fun userCapture(string: String?): ScreenImage

Shows a user prompt using a JavaScript alert. User will be required to click two separate locations. First click will be the top left corner of the image. Second click will be the bottom right. Selected area will be showing with a highlight to aid users.

Inherited Functions

above

open fun above(): SKryptonRegion

Gets the region above the top side with same width, the new region extends to the top screen border.

open fun above(height: Int): SKryptonRegion

Gets the region above the top side with same width, the new region extends by height pixels.

below

open fun below(): SKryptonRegion

Gets the region below the bottom side with same width, the new region extends to the bottom screen border.

open fun below(height: Int): SKryptonRegion

Gets the region below the bottom side with same width, the new region extends by height pixels.

click

open fun click(): Int

Left click at the region's last successful match, uses center if there is no last match. If region is a match, click targetOffset.

open fun <PFRML : Any> click(target: PFRML): Int

Attempts to find the target and click it.

open fun <PFRML : Any> click(target: PFRML, modifiers: Int): Int

Attempts to find the target and click it with modifiers.

compareTo

open operator fun compareTo(region: Region): Int

Compares the regions in terms of area.

doubleClick

open fun doubleClick(): Int
open fun <PFRML : Any> doubleClick(target: PFRML): Int
open fun <PFRML : Any> doubleClick(target: PFRML, modifiers: Int): Int

Like click but double that.

drag

open fun <PFRML : Any> drag(target: PFRML): Int

Initiates a mouse drag action. (Moves mouse to a location and presses without releasing)

dragDrop

open fun <PFRML : Any> dragDrop(target: PFRML): Int

Drags from region's last match and drop at given target using left mouse button.

open fun <PFRML : Any> dragDrop(t1: PFRML, t2: PFRML): Int

Drag from a position and drop to another using left mouse button.

dropAt

open fun <PFRML : Any> dropAt(target: PFRML): Int

Ends a mouse drop action. (Moves mouse to a location and releases the button)

exists

open fun <PSI : Any> exists(target: PSI): SKryptonMatch?
open fun <PSI : Any> exists(target: PSI, timeout: Double): SKryptonMatch?

Check if target exists (with the default autoWaitTimeout)

find

open fun <PSI : Any> find(target: PSI): SKryptonMatch

Finds the given target in the region and returns the best match. If AutoWaitTimeout is set, this is equivalent to wait(). Otherwise only one search attempt will be done.

findAll

open fun <PSI : Any> findAll(target: PSI): Iterator<SKryptonMatch>

Finds all occurrences of the given target in the region and returns an Iterator of SKryptonMatch.

getBottomLeft

open fun getBottomLeft(): Location

Gets the bottom left location of the region.

getBottomRight

open fun getBottomRight(): Location

Gets the bottom right location of the region.

getCenter

open fun getCenter(): Location

Gets the center of the region.

getLastMatch

open fun getLastMatch(): SKryptonMatch?

Gets the last match matched in this region.

getLastMatches

open fun getLastMatches(): Iterator<SKryptonMatch>

Gets last matches matched in this region.

getLocationFromTarget

open fun <PSIMRL : Any> getLocationFromTarget(target: PSIMRL): Location

Gets the Location of the target.

getTopLeft

open fun getTopLeft(): Location

Gets the top left location of the region.

getTopRight

open fun getTopRight(): Location

Gets the top right location of the region.

grow

open fun grow(l: Int, r: Int, t: Int, b: Int): SKryptonRegion
open fun grow(w: Int, h: Int): SKryptonRegion
open fun grow(range: Int): SKryptonRegion

Creates a region grown to the given values in pixels. Negative values can be passed to shrink instead.

open fun grow(): SKryptonRegion

Creates a region grown in pixels specified by org.sikuli.basics.Settings.DefaultPadding.

highlight

open fun highlight(): SKryptonRegion

Highlights the region.

open fun highlight(color: String): SKryptonRegion

Highlights the region with the given color

open fun highlight(secs: Int): SKryptonRegion
open fun highlight(secs: Float): SKryptonRegion

Highlights the region for the given duration.

open fun highlight(secs: Int, color: String): SKryptonRegion
open fun highlight(secs: Float, color: String): SKryptonRegion

Highlights the region for the given duration and color.

hover

open fun hover(): Int

Move the mouse pointer to region's last successful match, uses center if no last match. If region is a match, move to targetOffset. Same as mouseMove.

open fun <PFRML : Any> hover(target: PFRML): Int

Attempts to find the target and move the mouse pointer to it.

intersection

open fun intersection(region: Region): SKryptonRegion

Creates a region that is the intersection of the given regions.

keyDown

open fun keyDown(keycode: Int): Unit

Presses a specific key.

open fun keyDown(keys: String): Unit

Presses the keys specified by the string.

keyUp

open fun keyUp(): Unit

Releases all keys

open fun keyUp(keycode: Int): Unit

Releases a specific key.

open fun keyUp(keys: String): Unit

Releases the keys specified by the string.

left

open fun left(): SKryptonRegion

Gets the region left to the left side with same height, the new region extends to the left screen border.

open fun left(width: Int): SKryptonRegion

Gets the region left to the left side with same height, the new region extends by width pixels.

mouseDown

open fun mouseDown(buttons: Int): Unit

Presses mouse buttons.

mouseMove

open fun mouseMove(): Int

Moves the mouse pointer to the region's last successful match. Same as hover.

open fun mouseMove(xoff: Int, yoff: Int): Int

Moves the mouse from the current position to the offset position.

open fun <PFRML : Any> mouseMove(target: PFRML): Int

Moves the mouse to the given target.

mouseUp

open fun mouseUp(): Unit

Releases all mouse buttons.

open fun mouseUp(buttons: Int): Unit

Releases mouse buttons.

offset

open fun offset(loc: Location): SKryptonRegion

Returns a new Region object, whose upper left corner is relocated adding the location’s x and y value to the respective values of the given region. Width and height are the same. So this clones a region at a different place.

paste

open fun paste(text: String): Int

Pastes the given text into the current caret position.

open fun <PFRML : Any> paste(target: PFRML, text: String): Int

Pastes the given text into the target.

plus

open operator fun plus(region: Region): SKryptonRegion

Same as union.

right

open fun right(): SKryptonRegion

Gets the region right to the right side with same height, the new region extends to the right screen border.

open fun right(width: Int): SKryptonRegion

Gets the region right to the right side with same height, the new region extends by width pixels.

rightClick

open fun rightClick(): Int
open fun <PFRML : Any> rightClick(target: PFRML): Int
open fun <PFRML : Any> rightClick(target: PFRML, modifiers: Int): Int

Like click but uses right mouse button instead.

setLocation

open fun setLocation(loc: Location): SKryptonRegion

Set location of this region.

setROI

open fun setROI(): Unit
open fun setROI(rect: Rectangle): Unit
open fun setROI(region: Region): Unit
open fun setROI(X: Int, Y: Int, W: Int, H: Int): Unit

Sets the Region of Interest, mainly used to speed up searches.

skryptonScreen

fun skryptonScreen(): SKryptonScreen

Gets the screen this region belongs to as a SKryptonScreen

type

open fun type(text: String): Int
open fun type(text: String, modifiers: String): Int
open fun type(text: String, modifiers: Int): Int

Types the given text into the current caret position. Only ASCII characters are supported.

open fun <PFRML : Any> type(target: PFRML, text: String): Int
open fun <PFRML : Any> type(target: PFRML, text: String, modifiers: String): Int
open fun <PFRML : Any> type(target: PFRML, text: String, modifiers: Int): Int

Types the given text into the target. Only ASCII characters are supported.

union

open fun union(region: Region): SKryptonRegion

Creates a new region containing both regions.

wait

open fun <PSI : Any> wait(target: PSI): SKryptonMatch

Waits for the target to appear until the AutoWaitTimeout value is exceeded.

open fun <PSI : Any> wait(target: PSI, timeout: Double): SKryptonMatch

Waits for the target to appear or timeout (in second) is passed.

wheel

open fun wheel(direction: Int, steps: Int): Int

Spins the mouse wheel.

open fun <PFRML : Any> wheel(target: PFRML, direction: Int, steps: Int): Int
open fun <PFRML : Any> wheel(target: PFRML, direction: Int, steps: Int, stepDelay: Int): Int

Spins the mouse wheel at the given target