How to Automate your desktop using NodeJS

Today.. I was working on one of my projects and came across this interesting node module called RobotJs to automate your desktop. The only Node.js first Desktop Automation Library, the first of its kind and I really liked the way it works flawlessly.

Using RobotJS you can literally automate anything you can control the mouse, keyboard, and read the screen also they has cross platform support to support any of the desktop OS – Mac, Windows and Linux.

Install RobotJS

If you don’t have npm installed in your machine go to node.org and download and install NodeJS. NodeJS comes with npm built in.

How to Automate your desktop using RobotJS

Sine-wave example by RobotJS

Manipulating Keyboard

Capturing Screen

Use getMousePos() function to get the mouse position and then you can make robotjs to do capture or click the area as per your automation needs.

The robotjs is super easy to use and explanatory, i just wanted our readers to get to know that a automation library exists for Nodejs as well. If you’re thinking to automate using robotjs then you might want to read their docs completely.

robotjs docs – http://robotjs.io/docs