JSPM

simulate-native-click

0.7.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11
  • Score
    100M100P100Q32036F
  • License ISC

Simulate native clicks in node.js

Package Exports

  • simulate-native-click

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (simulate-native-click) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

simulate-native-click

Simple C++/WinApi addon that allow to simulate native clicks. TypeScript definitions inside.

Install

npm install simulate-native-click --save

Usage

var simulateClick = require("simulate-native-click");

let x = 100;
let y = 200;
simulateClick.left(hwnd, x, y);

x = 300;
y = 300;
simulateClick.right(hwnd, x, y);

simulateClick.getMousePosition(hwnd); // {x, y}
// position relative to window

simulateClick.getMousePosition(); // {x, y}
// global screen position returned if no hwnd provided

You can obtain HWND using winctl package https://www.npmjs.com/package/winctl

var win = winctl.GetActiveWindow();

let hwnd =  win.getHwnd();
let x = 100;
let y = 200;
simulateClick.left(hwnd, x, y);

You can also use it with electron:

let hwnd =  mainWindow.getNativeWindowHandle();
let x = 100;
let y = 200;
simulateClick.left(hwnd, x, y);