2.0.0 • Published 4 years ago

xoi v2.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Xoi Travis CI Build Status

Detect and control the mouse, keyboard and screen.

NPM Badge

Install

npm install xoi

Usage

const { mouse, keyboard, screen } = require("xoi");

// Realistically move the mouse to x=100 y=100
mouse.move(100, 100, { smooth: true });

// Right-click
mouse.click("right");

// When mouse clicked
mouse.on("click", ({ button }) => {
	console.log(`The ${button} mouse button was clicked.`)
});

// Type text
keyboard.type("Hello World!");

// When key pressed
keyboard.on("press", ({ key }) => {
	console.log(`${key} was pressed.`)
});

// Get hex code of pixel at x=100 y=100
const hex = screen.pixelAt(100, 100);
console.log(`The colour #${hex} is at x=100, y=100`);

API

For more information, see the documentation.

mouse

See the documentation

keyboard

See the documentation

screen

See the documentation

Prerequisites

See https://github.com/octalmage/robotjs#building and https://github.com/wilix-team/iohook/blob/master/docs/os-support.md