You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Examples
The following will move the mouse across the screen as a sine wave:
externcrate autopilot;externcrate rand;use rand::Rng;constTWO_PI:f64 = std::f64::consts::PI*2.0;fnsine_mouse_wave(){let screen_size = autopilot::screen::size();let scoped_height = screen_size.height / 2.0 - 10.0;// Stay in screen bounds.letmut rng = rand::thread_rng();for x in0..screen_size.widthasu64{let y = (scoped_height *((TWO_PI* x asf64) / screen_size.width).sin() +
scoped_height).round();let duration:u64 = rng.gen_range(1,3);
autopilot::mouse::move_to(autopilot::geometry::Point::new(
x asf64,
y asf64)).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:
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.
About
A simple, cross-platform GUI automation module for Rust.