A Deno library for interacting with the mouse 🖱️ keyboard ⌨️ and screen 💻

Overview

Contributors Stargazers Issues LinkedIn


🪶 Litebot 🤖

A Deno library for interacting with the mouse 🖱️ keyboard ⌨️ and screen 💻 . Litebot provides a simple API for creating kbm events, macros, & working with displays. Litebot leverages Deno's FFI to allow speedy low level control in C & C++ while having a typescript API exposed to the user.

Docs · Report Bug · Request Feature





Getting Started

This is an example of how you can get started with Litebot. You can also check out the examples folder for more documentation on each function.

  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 --allow-read --allow-ffi --allow-env --unstable https://deno.land/x/litebot/examples/mouse/mouse.ts
    
  4. If you want to upgrade / switch versions then please use the -r & -- --nocache flags when calling deno run or compile.

deno run -r --allow-read --allow-ffi --allow-env --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.

(back to top)

Usage

Mouse Position & Movement

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

{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">
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

Mouse / Keyboard Clicks

Handling mouse clicks and keyboard presses is also quiet easy with Litebot. The only diference is these operations are done on a seperate thread. It is vital to await them to avoid race conditions between clicks and keyboard presses,

import { setMousePos, mouseClick } from "https://deno.land/x/litebot/mod.ts";

// left click at position 50, 100
setMousePos(50, 100);
await mouseClick();

// right click at same position
await mouseClick({ leftClick: false });

// left click at -100, 100
await mouseClick({ x: -100, y: 100, leftClick: true });
// or
await mouseClick({ x: -100, y: 100 });

Deno Flags

  • --allow-env
  • --allow-read
  • --allow-ffi
  • --unstable

If you want to clear the cache or upgrade tyhe release please use these flags.

  • -- --nocache
  • -r

For more examples, please refer to the Documentation

(back to top)

Roadmap

  • Screen

    • getMonitors

    • getMonitorCount

    • getActiveMonitor

    • setPixelColor ([r, g, b])

    • getPixelColor (x, y)

    • getMouseColor

  • Mouse Actions

    • Left Click
    • Right Click
    • Double Click
      • Delayed Click
  • Keyboard Actions

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

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

Completed

  • Mouse Moving Relative
    • getMousePos
    • setMousePos
    • mouseUp
    • mouseLeft
    • mouseRight
    • mouseDown
    • mouseMove (pxX: number, pxY: number) -- move the mouse vertically and horicontaly at same time

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://deno.land/x/litebot/

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


You might also like...

📡Usagi-http-interaction: A library for interacting with Http Interaction API

📡 - A library for interacting with Http Interaction API (API for receiving interactions.)

Oct 24, 2022

Compact library for interacting with Ankr Scan Multichain API.

ankrscan.js Compact SDK for interacting with Ankr Scan MultiChain JSON-RPC API. SDK supports following MultiChain methods: getLogs - logs matching the

Jan 3, 2023

JavaScript library for parsing Dirtywave M8 files, complete with a CLI for interacting with M8 files.

m8-js This repository contains a JavaScript library for parsing Dirtywave M8 files, as well as a CLI for interacting with M8 files. The hopes are not

Dec 17, 2022

🛣️ A tiny and fast http request router designed for use with deno and deno deploy

Rutt Rutt is a tiny http router designed for use with deno and deno deploy. It is written in about 200 lines of code and is pretty fast, using an exte

Dec 10, 2022

This is a simple boilerplate for a Deno website, deployed with Deno Deploy.

Simple Deno Website Boilerplate This is a simple website boilerplate built using Deno and deployed using Deno Deploy. Demo at simple-deno-website-boil

Dec 3, 2022

TypeSafe MongoDB Atlas Data API SDK for Deno & Deno Deploy

Atlas SDK atlas_sdk is a TypeSafe MongoDB Atlas Data API SDK for Deno & Deno Deploy Links Docs Import Replace LATEST_VERSION with current latest versi

Dec 26, 2022

Deno bindings for yoga, using Deno FFI.

deno_yoga Deno bindings for yoga, using Deno FFI. Usage flags: --allow-ffi: Requires ffi access to "yogacore.dll", "libyogacore.so", "libyogacore.dyli

Feb 11, 2022

deno-ja (Deno Japanese community) showcase

Showcase Deno本家よりも気軽に作ったものを公開できるようなShowcaseです。 スクリーンショットの撮影方法 短めのidを決めていただいて、下記のようにスクリプトを実行してください。 deno task screenshot [url] [id] ※エラーが出る場合は、下記を実行してみ

Oct 28, 2022

A command-line tool to manage Deno scripts installed via deno install

🏞️ nublar nublar is a command-line tool to manage your scripts installed via deno install. 🛳️ Installation deno install --allow-read --allow-write -

Dec 26, 2022
Releases(v0.4.4)
Owner
Tyler Laceby
21 JavaScript/Svelte & C++. I make educational content relating to electron & svelte
Tyler Laceby
Canvas-based JavaScript UI element implementing touch, keyboard, mouse and scroll wheel support.

pure-knob Initially a (circular) knob / dial control with mouse, wheel, touch and keyboard support, implemented in pure JavaScript. In addition, this

Andre Plötze 44 Nov 4, 2022
Make the content slide prettily across the screen with variable sizes of scrolling items, in any of four directions, pausing while the mouse is over the marquee, and all with vanilla JavaScript.

TEG Marquee Make the content slide prettily across the screen with variable sizes of scrolling items, in any of four directions, pausing while the mou

Paul B. Joiner 0 Dec 30, 2021
As babies smash on the keyboard, images, letters and numbers appear on the screen

Baby Bam Bam As babies smash on the keyboard, images, letters and numbers appear on the screen. Try the many options and find the ones that are right

Boris Fritscher 3 Oct 24, 2022
Opinionated collection of TypeScript definitions and utilities for Deno and Deno Deploy. With complete types for Deno/NPM/TS config files, constructed from official JSON schemas.

Schemas Note: You can also import any type from the default module, ./mod.ts deno.json import { type DenoJson } from "https://deno.land/x/[email protected]

deno911 2 Oct 12, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
A small, but powerful HTTP library for Deno & Deno Deploy, built for convenience and simplicity

Wren Wren is a small, but powerful HTTP library for Deno & Deno Deploy, built for convenience and simplicity. convenient aliases for HTTP responses au

Jakub Neander 69 Dec 12, 2022
Type safe library for interacting with Mindbody's Public API (v6) and Webhooks

Mindbody API Type safe library for interacting with Mindbody's Public API (v6) and Webhooks ⚠️ Read before installing This library is typed according

SplitPass 4 Dec 9, 2022
Library for interacting with RMM protocol through ethers.js.

?? rmm-ethers Easily connect and transact with RMM protocol. ?? Features ?? Deploy RMM protocol ⚡️ Easily connect to an RMM deployment ?? Create RMM p

Primitive 14 Nov 13, 2022