Skip to main content

HidMouse

Controls a HID mouse.

import { HidMouse } from "@devicescript/core"

const hidMouse = new HidMouse()

Commands

setButton

Sets the up/down state of one or more buttons. A Click is the same as Down followed by Up after 100ms. A DoubleClick is two clicks with 150ms gap between them (that is, 100ms first click, 150ms gap, 100ms second click).

hidMouse.setButton(buttons: HidMouseButton, ev: HidMouseButtonEvent): Promise<void>

move

Moves the mouse by the distance specified. If the time is positive, it specifies how long to make the move.

hidMouse.move(dx: number, dy: number, time: number): Promise<void>

wheel

Turns the wheel up or down. Positive if scrolling up. If the time is positive, it specifies how long to make the move.

hidMouse.wheel(dy: number, time: number): Promise<void>