{"id":19225960,"url":"https://github.com/developer239/robot-ts","last_synced_at":"2025-08-15T22:38:18.718Z","repository":{"id":157752672,"uuid":"633581155","full_name":"developer239/robot-ts","owner":"developer239","description":"Native keyboard, mouse and display controls for your Node application.","archived":false,"fork":false,"pushed_at":"2023-04-28T01:46:28.000Z","size":174,"stargazers_count":3,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-17T10:56:31.695Z","etag":null,"topics":["display","keyboard","macos","mouse","move","png","robot","robot-js","robotjs","ts","type","typescript","windows"],"latest_commit_sha":null,"homepage":"https://github.com/developer239/robot-ts#installation","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/developer239.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2023-04-27T20:31:34.000Z","updated_at":"2024-11-15T09:04:27.000Z","dependencies_parsed_at":"2023-09-05T14:16:19.964Z","dependency_job_id":null,"html_url":"https://github.com/developer239/robot-ts","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/developer239/robot-ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer239%2Frobot-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer239%2Frobot-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer239%2Frobot-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer239%2Frobot-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/developer239","download_url":"https://codeload.github.com/developer239/robot-ts/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer239%2Frobot-ts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270639124,"owners_count":24620663,"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","status":"online","status_checked_at":"2025-08-15T02:00:12.559Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["display","keyboard","macos","mouse","move","png","robot","robot-js","robotjs","ts","type","typescript","windows"],"created_at":"2024-11-09T15:16:55.108Z","updated_at":"2025-08-15T22:38:18.690Z","avatar_url":"https://github.com/developer239.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Robot TS 🤖\n\n[![npm version](http://img.shields.io/npm/v/robot-ts.svg?style=flat)](https://www.npmjs.com/package/robot-ts \"View this project on npm\")\n\nThis library is inspired by older unmaintained libraries like [octalmage/robotjs](https://github.com/octalmage/robotjs)\nand [Robot/robot-js](https://github.com/Robot/robot-js). The goal is to provide cross-platform controls for various\ndevices such as keyboard, mouse, and screen for Node.js applications.\n\nYou can find C++ implementation CMake library 📚 [here: developer239/robot-cpp](https://github.com/developer239/robot-cpp)\n\n**Supported system:**\n\n- MacOS\n- Windows **(not tested yet)**\n\nIn case of Linux, please, create issue and leave a star ⭐ and I will implement support. Right now I want to focus on port to\nNode.js using Node-API.\n\n### Known issues:\n\n- Work in progress. If you need specific features, please, create an issue and I will prioritize it.\n- I never tested this on Windows. 🙏\n- It seems that special keys bindings are not implemented correctly.\n- Upper case is converted to lower case when typing. (it will be possible to use shift key when special keys are fixed though)\n- It seems that screen bindings are not implemented correctly.\n\n## Installation:\n\nMake sure that you can build C++ projects on your machine and that you have [CMake](https://cmake.org) installed.\n\n- On MacOS: `brew install cmake`\n- On Windows: `choco install cmake`\n\nInstall Node dependencies:\n\n```shell\nyarn add robot-ts\n```\n\n## Keyboard ⌨️\n\nThe `Keyboard` class provides a interface for simulating keyboard key presses, releases, and typing.\n\n### Public Methods\n\n- `type(query: string): void`\n  Types the given text as a string.\n\n- `typeHumanLike(query: string): void`\n  Types the given text as a string with a human-like typing speed.\n\n- `click(asciiChar: string): void`\n  Simulates a key press and release for the specified ASCII character.\n\n- `click(specialKey: SpecialKey): void`\n  Simulates a key press and release for the specified special key.\n\n- `press(asciiChar: string): void`\n  Simulates a key press for the specified ASCII character.\n\n- `press(specialKey: SpecialKey): void`\n  Simulates a key press for the specified special key.\n\n- `release(asciiChar: string): void`\n  Simulates a key release for the specified ASCII character.\n\n- `release(specialKey: SpecialKey): void`\n  Simulates a key release for the specified special key.\n\n### Example Usage\n\n```typescript\nimport { Keyboard } from \"robot-ts\";\n\nKeyboard.typeHumanLike(\"hello, world\");\n```\n\n## Mouse 🖱️\n\nThe `Mouse` class provides a interface for controlling the mouse cursor, simulating mouse clicks, and scrolling.\n\n### Public Methods\n\n- `move(point: Point): void`\n  Moves the mouse cursor to the specified point (x, y).\n\n- `moveSmooth(point: Point, speed?: number): void`\n  Moves the mouse cursor smoothly to the specified point (x, y) at the given speed.\n\n- `drag(point: Point, speed?: number): void`\n  Drags the mouse cursor to the specified point (x, y) at the given speed.\n\n- `getPosition(): Point`\n  Returns the current position of the mouse cursor as a `Point`.\n\n- `toggleButton(down: boolean, button: MouseButton, doubleClick?: boolean): void`\n  Presses or releases the specified mouse button depending on the `down` argument. If `doubleClick` is set to true, it will perform a double click.\n\n- `click(button: MouseButton): void`\n  Simulates a single click using the specified mouse button.\n\n- `doubleClick(button: MouseButton): void`\n  Simulates a double click using the specified mouse button.\n\n- `scrollBy(y: number, x?: number): void`\n  Scrolls the mouse wheel by the specified x and y distances.\n\n### Example Usage\n\n```typescript\nimport { Mouse } from \"robot-ts\";\n\nMouse.moveSmooth({ x: 100, y: 200 });\n```\n\n## Screen 🖥️\n\nThe `Screen` class provides functionality to capture the screen, get pixel colors, and save the captured screen as a PNG image.\n\n### Public Methods\n\n- `getPixelColor(x: number, y: number): Pixel`\n  Returns the color of the pixel at the specified (x, y) coordinates as a `Pixel` structure.\n\n- `getScreenSize(): DisplaySize`\n  Returns the size of the screen as a `DisplaySize` structure containing the width and height.\n\n- `capture(x?: number, y?: number, width?: number, height?: number): void`\n  Captures a rectangular area of the screen defined by the specified (x, y) coordinates and dimensions (width, height).\n\n- `getPixels(): Pixel[]`\n  Returns an array of `Pixel` structures representing the captured screen.\n\n- `saveAsPNG(filename: string): void`\n  Saves the captured screen as a PNG image with the specified filename.\n\n### Example Usage\n\n```typescript\nimport { Screen } from \"robot-ts\";\n\nconst screen = new Screen();\nscreen.capture(0, 0, 800, 600);\nconst pixel = screen.getPixelColor(100, 200);\nscreen.saveAsPNG(\"screenshot.png\");\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeveloper239%2Frobot-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeveloper239%2Frobot-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeveloper239%2Frobot-ts/lists"}