New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

node-cursor

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-cursor

Windows mouse cursor utils.

latest
Source
npmnpm
Version
1.1.2
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

node-cursor

A node module to get information about the Windows mouse cursor, change its position and simulate clicks.

Installation

You must have Python and Visual Studio Community installed in order to install this package.

yarn add node-cursor

or

npm install node-cursor

Usage

Using import syntax

import {getCursorPosition, setCursorPosition, sendCursorEvent, cursorEvents} from "node-cursor";

getCursorPosition();
//Return: { x: 0, y: 0 }

setCursorPosition({
    x: 0,
    y: 0
});

//Send mouse click at 0, 0
sendCursorEvent({
    event: cursorEvents.LEFT_DOWN,
    data: 0,
    x: 0,
    y: 0
});
sendCursorEvent({
    event: cursorEvents.LEFT_UP,
    data: 0,
    x: 0,
    y: 0
});

//Scroll wheel
sendCursorEvent({
    event: cursorEvents.WHEEL,
    data: 120, //amount of wheel movement
    x: 0,
    y: 0
});

Using require syntax

const NodeCursor = require("node-cursor");

NodeCursor.getCursorPosition();
//Return: { x: 0, y: 0 }

NodeCursor.setCursorPosition({
    x: 0,
    y: 0
});

//Send mouse click at 0, 0
NodeCursor.sendCursorEvent({
    event: NodeCursor.cursorEvents.LEFT_DOWN,
    data: 0,
    x: 0,
    y: 0
});
NodeCursor.sendCursorEvent({
    event: NodeCursor.cursorEvents.LEFT_UP,
    data: 0,
    x: 0,
    y: 0
});

//Scroll wheel
NodeCursor.sendCursorEvent({
    event: NodeCursor.cursorEvents.WHEEL,
    data: 120, //amount of wheel movement
    x: 0,
    y: 0
});

Built-in Events:

import {cursorEvents} from "node-cursor";

cursorEvents.LEFT_DOWN //0x0002
cursorEvents.LEFT_UP //0x0004
cursorEvents.RIGHT_DOWN //0x0008
cursorEvents.RIGHT_UP //0x0010
cursorEvents.MIDDLE_DOWN //0x0020
cursorEvents.MIDDLE_UP //0x0040
cursorEvents.WHEEL //0x0800

All events

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Keywords

Click

FAQs

Package last updated on 14 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts