skrypton-api / com.waicool20.skrypton.sikulix.input / SKryptonMouse

SKryptonMouse

class SKryptonMouse

Class representing a virtual mouse for a com.waicool20.skrypton.sikulix.SKryptonScreen This class is also in charge of coordinating mouse actions between threads, unlike SKryptonRobot all functions are synchronized and thus only one thread may have access to keyboard actions.

Constructors

<init>

SKryptonMouse(robot: SKryptonRobot)

Main constructor

Properties

robot

val robot: SKryptonRobot

SKryptonRobot used for generating actions.

Functions

atomicAction

fun <T> atomicAction(action: () -> T): T

Executes an action atomically while keeping the synchronized lock to this object. Useful if you want to do multiple actions in one go without the possibility of a thread stealing ownership.

click

fun click(location: Location, buttons: Int, modifiers: Int): Unit

Sends a click at a given location

doubleClick

fun doubleClick(location: Location, buttons: Int, modifiers: Int): Unit

Sends a double click at a given location

drag

fun drag(location: Location, resetDelays: Boolean = true): Unit

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

dragDrop

fun dragDrop(loc1: Location, loc2: Location): Unit

Same as calling drag with loc1 then dropAt with loc2 but does this all at once while keeping the lock to this object.

dropAt

fun dropAt(location: Location, resetDelays: Boolean = true): Unit

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

mouseDown

fun mouseDown(buttons: Int): Unit

Presses mouse buttons.

mouseUp

fun mouseUp(buttons: Int = 0): Int

Releases mouse buttons.

moveTo

fun moveTo(location: Location): Unit

Moves the mouse cursor to a given location.

spinWheel

fun spinWheel(location: Location?, direction: Int, steps: Int, stepDelay: Int): Unit

Spins the mouse wheel.