{"id":13392708,"url":"https://github.com/octalmage/robotjs","last_synced_at":"2025-05-14T22:05:44.573Z","repository":{"id":20242614,"uuid":"23515024","full_name":"octalmage/robotjs","owner":"octalmage","description":"Node.js Desktop Automation. ","archived":false,"fork":false,"pushed_at":"2024-06-21T20:00:52.000Z","size":939,"stargazers_count":12549,"open_issues_count":197,"forks_count":985,"subscribers_count":205,"default_branch":"master","last_synced_at":"2025-05-14T22:05:28.679Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://robotjs.io","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/octalmage.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-08-31T14:13:47.000Z","updated_at":"2025-05-14T13:35:34.000Z","dependencies_parsed_at":"2024-02-03T08:44:38.463Z","dependency_job_id":"566afecd-0f09-4533-9516-33774cdb7737","html_url":"https://github.com/octalmage/robotjs","commit_stats":{"total_commits":507,"total_committers":60,"mean_commits":8.45,"dds":0.3846153846153846,"last_synced_commit":"8ae87a91f06f49559f0db387bc2bd1ea01419880"},"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octalmage%2Frobotjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octalmage%2Frobotjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octalmage%2Frobotjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octalmage%2Frobotjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/octalmage","download_url":"https://codeload.github.com/octalmage/robotjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254235687,"owners_count":22036962,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T17:00:35.522Z","updated_at":"2025-05-14T22:05:44.516Z","avatar_url":"https://github.com/octalmage.png","language":"C","readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"https://cldup.com/1ATDf2JMtv.png\"\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://travis-ci.org/octalmage/robotjs\"\u003e\u003cimg src=\"https://api.travis-ci.org/octalmage/robotjs.svg?branch=master\"\u003e\u003c/a\u003e \u003ca href=\"https://ci.appveyor.com/project/octalmage/robotjs\"\u003e\u003cimg src=\"https://ci.appveyor.com/api/projects/status/qh2eqb37j7ap6x36?svg=true\"\u003e\u003c/a\u003e \u003ca href=\"https://www.npmjs.com/package/robotjs\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/robotjs.svg\"\u003e\u003c/a\u003e \u003ca href=\"https://gitter.im/octalmage/robotjs?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge\"\u003e\u003cimg src=\"https://img.shields.io/badge/gitter-join%20chat-blue.svg\"\u003e\u003c/a\u003e \u003ca href=\"http://waffle.io/octalmage/robotjs\"\u003e\u003cimg src=\"https://img.shields.io/waffle/label/octalmage/robotjs/ready.svg?maxAge=3600\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003e Node.js Desktop Automation. Control the mouse, keyboard, and read the screen.\n\nRobotJS supports Mac, [Windows](https://github.com/octalmage/robotjs/issues/2), and [Linux](https://github.com/octalmage/robotjs/issues/17).\n\nThis is a work in progress so the exported functions could change at any time before the first stable release (1.0.0). [Ideas?](https://github.com/octalmage/robotjs/issues/4)\n\n[Check out some of the cool things people are making with  RobotJS](https://github.com/octalmage/robotjs/wiki/Projects-using-RobotJS)! Have your own rad RobotJS project? Feel free to add it!\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://twitter.com/robotjavascript\"\u003e\u003cimg width=\"300\" src=\"https://cldup.com/Et-C6_ue45.png\"\u003e\u003c/a\u003e\u003ca href=\"http://blog.robotjs.io\"\u003e\u003cimg width=\"300\" src=\"https://cldup.com/3apDirNmSB.png\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n## Contents\n\n- [Installation](#installation)\n- [Examples](#examples)\n- [API](https://robotjs.io/docs/syntax)\n- [Building](#building)\n- [Plans](#plans)\n- [Progress](#progress)\n- [FAQ](#faq)\n- [License](#license)\n\n## Installation\n\nInstall RobotJS using npm:\n\n```\nnpm install robotjs\n```\nIt's that easy! npm will download one of the prebuilt [binaries](https://github.com/octalmage/robotjs/releases/latest) for your OS.\n\nYou can get npm [here](https://nodejs.org/en/download/) if you don't have it installed.\n\nIf you need to build RobotJS, see the [building](#building) section. Instructions for [Electron](https://github.com/octalmage/robotjs/wiki/Electron).\n\n## Examples\n\n##### [Mouse](https://github.com/octalmage/robotjs/wiki/Syntax#mouse)\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://cldup.com/lugVjjAkEi.gif\"\u003e\u003c/p\u003e\n\n```JavaScript\n// Move the mouse across the screen as a sine wave.\nvar robot = require(\"robotjs\");\n\n// Speed up the mouse.\nrobot.setMouseDelay(2);\n\nvar twoPI = Math.PI * 2.0;\nvar screenSize = robot.getScreenSize();\nvar height = (screenSize.height / 2) - 10;\nvar width = screenSize.width;\n\nfor (var x = 0; x \u003c width; x++)\n{\n\ty = height * Math.sin((twoPI * x) / width) + height;\n\trobot.moveMouse(x, y);\n}\n```\n\n##### [Keyboard](https://github.com/octalmage/robotjs/wiki/Syntax#keyboard)\n\n```JavaScript\n// Type \"Hello World\" then press enter.\nvar robot = require(\"robotjs\");\n\n// Type \"Hello World\".\nrobot.typeString(\"Hello World\");\n\n// Press enter.\nrobot.keyTap(\"enter\");\n```\n\n##### [Screen](https://github.com/octalmage/robotjs/wiki/Syntax#screen)\n\n```JavaScript\n// Get pixel color under the mouse.\nvar robot = require(\"robotjs\");\n\n// Get mouse position.\nvar mouse = robot.getMousePos();\n\n// Get pixel color in hex format.\nvar hex = robot.getPixelColor(mouse.x, mouse.y);\nconsole.log(\"#\" + hex + \" at x:\" + mouse.x + \" y:\" + mouse.y);\n```\nRead the [Wiki](https://github.com/octalmage/robotjs/wiki) for more information!\n\n## [API](http://robotjs.io/docs/syntax)\n\nThe RobotJS API is hosted at \u003chttps://robotjs.io/docs/syntax\u003e.\n\n## Building\n\nPlease ensure you have the required dependencies before installing:\n\n* Windows\n  * windows-build-tools npm package (`npm install --global --production windows-build-tools` from an elevated PowerShell or CMD.exe)\n* Mac\n  * Xcode Command Line Tools.\n* Linux\n  * Python (v2.7 recommended, v3.x.x is not supported).\n  * make.\n  * A C/C++ compiler like GCC.\n  * libxtst-dev and libpng++-dev (`sudo apt-get install libxtst-dev libpng++-dev`).\n\nInstall node-gyp using npm:\n\n```\nnpm install -g node-gyp\n```\n\nThen build:\n\n```\nnode-gyp rebuild\n```\n\nSee the [node-gyp readme](https://github.com/nodejs/node-gyp#installation) for more details.\n\n## Plans\n\n* √ Control the mouse by changing the mouse position, left/right clicking, and dragging.\n* √ Control the keyboard by pressing keys, holding keys down, and typing words.\n* √ Read pixel color from the screen and capture the screen.\n* Find an image on screen, read pixels from an image.\n* Possibly include window management?\n\n## Progress\n\n| Module        | Status        | Notes   |\n| ------------- |-------------: | ------- |\n| Mouse         | 100%           | All planned features implemented.       |\n| Keyboard      | 100%           | All planned features implemented.       |\n| Screen        | 85%            | Image search, pixel search. |\n| Bitmap        | 0%             |  Saving/opening, png support.  |\n\n## FAQ\n\n#### Does RobotJS support global hotkeys? \n\nNot currently, and I don't know if it ever will. I personally use [Electron](http://electron.atom.io/)/[NW.js](http://nwjs.io/) for global hotkeys, and this works well. Later on I might add hotkey support or create a separate module. See [#55](https://github.com/octalmage/robotjs/issues/55) for details. \n\n#### Can I take a screenshot with RobotJS? \n\nSoon! This is a bit more complicated than the rest of the features, so I saved it for last. Luckily the code is already there, I just need to write the bindings, and I've already started. Subscribe to [#13](https://github.com/octalmage/robotjs/issues/13) for updates. \n\n#### Why is \u0026#60;insert key\u0026#62; missing from the keyboard functions? \n\nWe've been implementing keys as we need them. Feel free to create an issue or submit a pull request!\n\n#### How about multi-monitor support?\n\nThe library doesn't have explicit multi-monitor support, so anything that works is kind of on accident. Subscribe to [#88](https://github.com/octalmage/robotjs/issues/88) for updates.\n\nFor any other questions please [submit an issue](https://github.com/octalmage/robotjs/issues/new).\n\n## Story\n\nI'm a huge fan of [AutoHotkey](https://www.autohotkey.com/), and I've used it for a very long time. AutoHotkey is great for automation and it can do a bunch of things that are very difficult in other languages. For example, it's [imagesearch](https://www.autohotkey.com/docs/commands/ImageSearch.htm) and [pixel](https://www.autohotkey.com/docs/commands/PixelGetColor.htm) related functions are hard to reproduce on Mac, especially in scripting languages. These functions are great for automating apps that can't be automated like [Netflix](http://blueshirtdesign.com/apps/autoflix/). This has never been a big deal since I've always used Windows at work, but for the past few years I've been using Mac exclusively. \n\nI like AutoHotkey, but I like Node.js more. By developing RobotJS I get an AutoHotkey replacement on Mac (finally!), and I get to use my favorite language. \n\n**TLDR:** There's nothing like AutoHotkey on Mac, so I'm making it. \n\n## License\n\nMIT\n\nBased on [autopy](https://github.com/msanders/autopy). \nMaintained by [Jason Stallings](http://jason.stallin.gs).\n","funding_links":[],"categories":["C","Packages","包","Repository","目录","others","Automation","Tools","Number"],"sub_categories":["Automation","自动化","Automation \u0026 RPA","React Components","Video Conference"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foctalmage%2Frobotjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foctalmage%2Frobotjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foctalmage%2Frobotjs/lists"}