7

Autopilot - Cross platform desktop automation for Deno

 3 years ago
source link: https://github.com/divy-work/autopilot-deno
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

3meANbz.png!web

AutoPilot is a simple cross-platform desktop automation library for Deno.

NOTE: Works with Deno v1.0.5 or up.

Features

  • Keyboard

    • Type a string using .type
    • Tap a key using .tap
    • Toggle key using .toggleKey
  • Mouse

    • Simulate mouse movement using .moveMouse
    • Click using .click
    • Simulate a scroll using .scroll
    • Get mouse position using .mousePosition
    • Get mouse position pixel color .pixelColor
  • Screen

    • Capture screen using .screenshot
    • Get screen size using .screenSize
    • Check if point out of bounds using .pointVisible
    • Get number of pixels in a point using .screenScale
    • Screen recording
  • Notifications

    • Native popup using .alert
    • Notifications using .notify
  • Monitors

    • Get the number of monitors using .getMonitors
  • Window management (only for linux)

    • Get window title using .getWindow
    • Transform windows size using .transformByIndex

Join Discord

aYJNJrq.png!web

Documentation

Detailed documentation of the API is available at:

https://autopilot.divy.work

Requirements

Linux

sudo apt-get update
sudo apt-get install libdbus-1-dev x11-xserver-utils wmctrl libxtst-dev cmake libc-dev libx11-dev libxcb1-dev

Usage

Running your Deno script with AutoPilot requires some flags

deno run --unstable -A file.ts

NOTE: Prebuilt binaries are automatically downloaded the first time you import Autopilot in your project and are cached.

import AutoPilot from 'https://deno.land/x/autopilot/mod.ts';

// create a new AutoPilot instance.
var pilot = new AutoPilot();

// type a string
pilot.type("Yay! This works");

// alert something
pilot.alert("This is a alert");

// get screen size
pilot.screenSize();

// move mouse
pilot.moveMouse(200, 400);

// take a full-screen screenshot
pilot.screenshot("screenshot.png");

Env variables

CACHE
DEV

Development

  • Requires rust and cargo.
  • Requires velociraptor (script runner for Deno) - Makes life easier

Clone this repo and run cargo build to produce a development build.

Commands

  • Run tests : vr test
  • Run and produce benchmarks : vr bench
  • Format code fmt : vr fmt
  • Create development build: vr build

Contributing

Contributing code and ideas to AutoPilot is really easy! You can join the Discord server or Create an issue or PR. :)

License

See MIT License . All rights reserved. Divy Srivastava 2020.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK