# node-cursor

> Windows mouse cursor utils.

Latest version **1.1.2** (published 2022-02-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-cursor
pnpm add node-cursor
yarn add node-cursor
bun add node-cursor
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2022-02-14 |
| First published | 2021-06-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 3 |
| Author | hetrodo |
| Maintainers | hetrodo |
| Keywords | Click, Mouse, Cursor, Windows, Simulate, Position, Cursor position |

## Links

- npm: https://www.npmjs.com/package/node-cursor
- Repository: https://github.com/hetrodoo/hetrodo-node-cursor-napi
- Homepage: https://github.com/hetrodoo/hetrodo-node-cursor-napi#readme
- Issues: https://github.com/hetrodoo/hetrodo-node-cursor-napi/issues
- npm.io page: https://npm.io/package/node-cursor

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.1.2 (latest) — 2022-02-14
- 1.1.1 — 2021-06-11
- 1.1.0 — 2021-06-11
- 1.0.1 — 2021-06-10
- 1.0.0 — 2021-06-10

## README

# [node-cursor](https://www.npmjs.com/package/node-cursor)

A node module to get information about the Windows mouse cursor, change its position and simulate clicks.

## Installation
#### You must have [Python](https://www.python.org/) and [Visual Studio Community](https://visualstudio.microsoft.com/pt-br/) installed in order to install this package.

```bash
yarn add node-cursor
```

or

```bash
npm install node-cursor
```

## Usage

#### Using import syntax

```typescript
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

```javascript
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:
```typescript
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](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-mouse_event#parameters)

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

## License

[MIT](https://choosealicense.com/licenses/mit/)

---
_Source: https://npm.io/package/node-cursor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
