Rust Apache-2.0

autopilot-rs

A simple, cross-platform GUI automation module for Rust.

A

autopilot-rs

Dernière activité 28 sept. 2026
autopilot-rs/autopilot-rs

429

étoiles

53

forks

16

issues ouvertes

automationcross-platformguiinputrustsimulation

Ce README est souvent en anglais.

Docs Crates.io Appveyor Build Status Github Build Status

AutoPilot

AutoPilot is a Rust port of the Python C extension AutoPy, a simple, cross-platform GUI automation library for Python. For more information, see the README on that repo.

Currently supported on macOS, Windows, and X11 with the XTest extension.

Builds use Rust 1.98.1, selected by rust-toolchain.toml.

Examples

The following will move the mouse across the screen as a sine wave:

extern crate autopilot;
extern crate rand;
use rand::RngExt;

const TWO_PI: f64 = std::f64::consts::PI * 2.0;
fn sine_mouse_wave() {
    let screen_size = autopilot::screen::size();
    let scoped_height = screen_size.height / 2.0 - 10.0; // Stay in screen bounds.
    let mut rng = rand::rng();
    for x in 0..screen_size.width as u64 {
        let y = (scoped_height * ((TWO_PI * x as f64) / screen_size.width).sin() + 
                 scoped_height).round();
        let duration: u64 = rng.random_range(1..3);
        autopilot::mouse::move_to(autopilot::geometry::Point::new(
            x as f64,
            y as f64
        )).expect("Unable to move mouse");
        std::thread::sleep(std::time::Duration::from_millis(duration));
    }
}

This will enter the keys from the string "Hello, world!" and then prompt an alert with the same text:

extern crate autopilot;

fn main() {
    autopilot::key::type_string("Hello, world!", &[], 200., 0.);
    let _ = autopilot::alert::alert("Hello, world!", None, None, None);
}

Contributing

If you are interested in this project, please consider contributing. Here are a few ways you can help:

License

This project is licensed under either the Apache-2.0 or MIT license, at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Projets similaires

A simple, cross-platform GUI automation module for Python and Rust.

Rustautomationcross-platformgui
Aautopilot-rs
981 étoiles107

Cross platform input simulation in Rust

Rustautomationcross-platforminput
Eenigo-rs
1,8 k étoiles159

RobotGo, Go Native cross-platform RPA, GUI automation, Auto test and Computer use @vcaesar

Goaiauto-testautomation
Ggo-vgo
10,8 k étoiles961