Skip to main content

Contributors Stargazers Issues LinkedIn


🪶 Litebot 🤖

Litebot is a Deno package for interacting with the mouse 🖱️ keyboard ⌨️ and screen 💻. The focus of Litebot is to provide a fast and simple API for writing bots and programs that need fine control over the keyboard and mouse. Windows API Only

Docs · Report Bug · Request Feature





Getting Started

This is an example of how you can get started with Litebot.

  1. Import Litebot

    import * as litebot from "https://deno.land/x/litebot/mod.ts";
  2. Using Litebot Sub-Modules

    import { getMousePos } from "https://deno.land/x/litebot/mod.ts";
    getMousePos(); // { x: number, y: number }
  3. Example Scripts

    deno run -A --unstable https://deno.land/x/litebot/examples/mouse/mouse.ts
  4. If you want to upgrade / switch versions then please use the -r flag when calling deno run or compile.

deno run -r -A --unstable https://deno.land/x/litebot/examples/mouse/mouse.ts

This will pevent the previously cached dll from being used and will fresh install the new dll.

This is important if you change versions.

(back to top)

Usage

Currently this library will only work for windows machines. Lets demonstrate how to use some common Litebot functions.

import { getMousePos, setMousePos, moveMouse, mouseUp, mouseLeft, mouseDown, mouseRight } from "https://deno.land/x/litebot/mod.ts";

// Get current position of mouse

const { x, y } = getMousePos();

// Setting the mouse position

setMousePos(0, 0);
setMousePos(-20000, 20398); // unsuccessful call results in the mouse being at the endge of the screen on the x and y

// Relative Mouse Movement
setMousePos (500, 500); // => {x: 500, y: 500}
moveMouse (100, -150); // -> {x: 600, y: 650}; // right 100 & down 150
moveMouse (0, 400); // -> {x: 600, y: 250}; // up 400

// Single Axis Relative Movement

mouseUp (20) // moves mouse up the screen by 20px
mouseUp (-20) // moves mouse down the screen by 20px
// Its possible to move by both positive and negative quantities. This simply inverts the direction again.

mouseLeft (100) // moves mouse left on screen by 100px
mouseRight (-23) // moves mouse left on screen by 23px
mouseDown (100) // moves mouse down on screen by 100px

For more examples, please refer to the Documentation

(back to top)

Roadmap

  • Mouse Moving Relative -/ WIN

    • mouseUp (px?: number)
    • mouseLeft (px?: number)
    • mouseRight (px?: number)
    • mouseDown (px?: number)
    • mouseMove (pxX: number = 1, pxY: number) – move the mouse vertically and horicontaly at same time
  • Color @ Pixel -/ Win

    • Color @ Cursor
    • RGB & Hex Support
  • Mouse Actions -/ Win

    • Left Click
    • Right Click
    • Double Click
      • Delayed Click
  • Keyboard Actions -/ Win

    • sendKey (keyCode : Litebot.Keycode )
    • sendKeys ( message : string )
    • keyPress (key : Litebot.Keycode | char )
    • keyRelease (key : Litebot.Keycode | char )
  • Macro’s/ Win

    • Macro.startRecordMacro ()
    • Macro.endRecordMacro ()
    • Macro.playBack ()
    • Macro.erase ()
    • Macro.saveMacro () : Litebot.Action []

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contact

Tyler Laceby: @tylerbadger23 - Twitter

My Channel: JSimplified - YouTube

Deno Repo: https://github.com/tylerlaceby/litebot

Project Link: https://github.com/tylerlaceby/litebot