w-mousekey
v1.0.16
Published
An operator for mouse and keyboard in nodejs.
Downloads
162
Maintainers
Readme
w-mousekey
An operator for mouse and keyboard in nodejs.
Documentation
To view documentation or get support, visit docs.
Core
w-mousekeyis basing on@techstark/opencv-js(WASM),sharp,screenshot-desktopandAutoHotkey.
Installation
Using npm(ES6 module):
npm i w-mousekeyNo native OpenCV installation required. Image matching uses @techstark/opencv-js (WebAssembly), which works on any Node.js version without compilation.
Example
import mk from 'w-mousekey/src/mousekey.mjs'
import sc from 'w-mousekey/src/screen.mjs'
import cp from 'w-mousekey/src/compare.mjs'
import ckPic from 'w-mousekey/src/ckPic.mjs'
// mouseClick
await mk.mouseClick(100, 100)
// sendString
await mk.sendString('Hello World!')
// screenSave
await sc.screenSave(0, 0, 600, 1000, './screenshot.png')
// calcSimilarity
let r = await cp.calcSimilarity('./target.png', './screenshot.png', 1)
console.log(r) // { similarity, x, y, width, height, scale }
// ckPic - find image on screen and click
let found = await ckPic('target', { threshold: 0.9 })
console.log(found) // true or false