Skip to content

dashprasad23/crosscontrol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

crosscontrol

crosscontrol is a cross-platform Node.js native addon for automating mouse and keyboard input, and reading screen pixel data. Useful for scripting, testing, and UI automation tasks.


✨ Features

  • Move the mouse to any screen coordinates
  • Perform left, right, or middle clicks
  • Read the current mouse position
  • Simulate individual keys or key combinations
  • Get the RGB/Hex color of any screen pixel

✅ Platform Support

  • macOS – Fully tested
  • 🟡 Windows – In progress (core functions work)
  • Linux – Not supported

📦 Installation

npm install crosscontrol

⚠️ Requires native build toolchain:

  • macOS: Xcode Command Line Tools
  • Windows: Visual Studio with C++ support + Windows Build Tools
  • Linux: Not supported

🚀 Usage Example

const cc = require('crosscontrol');

cc.moveMouse(500, 300);
cc.clickMouse();

console.log(cc.getMousePosition()); // { x: 500, y: 300 }

cc.typeKey("a");
cc.typeCombo(["ctrl", "c"]);

const rgb = cc.getPixelColor(100, 100);
console.log(rgb); // { r: 255, g: 255, b: 255 }

console.log(cc.getPixelHex(100, 100)); // "#ffffff"

await cc.typeString("hello world\n");

🧩 API Reference

Mouse

  • moveMouse(x, y)
  • clickMouse()
  • rightClickMouse()
  • middleClickMouse()
  • getMousePosition() → { x, y }

Keyboard

  • typeKey(key)
  • typeKeyWithState(key, isDown)
  • typeCombo([keys])
  • typeString(str, delay?)

Pixel

  • getPixelColor(x, y) → { r, g, b }
  • getPixelHex(x, y) → "#rrggbb"

📄 License

MIT


🤝 Contributing

Contributions welcome – especially for improving Windows support!

About

Cross-platform Node.js native module for controlling mouse, keyboard, and reading screen pixel data

Resources

License

Stars

Watchers

Forks

Packages

No packages published