2021-03-29 15:59:14 +08:00
|
|
|
use enigo::{Enigo, MouseButton, MouseControllable};
|
|
|
|
use std::thread;
|
|
|
|
use std::time::Duration;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let wait_time = Duration::from_secs(2);
|
|
|
|
let mut enigo = Enigo::new();
|
|
|
|
|
|
|
|
thread::sleep(wait_time);
|
|
|
|
|
|
|
|
enigo.mouse_move_to(500, 200);
|
|
|
|
thread::sleep(wait_time);
|
|
|
|
|
2021-12-24 19:13:11 +08:00
|
|
|
enigo.mouse_down(MouseButton::Left).ok();
|
2021-03-29 15:59:14 +08:00
|
|
|
thread::sleep(wait_time);
|
|
|
|
|
|
|
|
enigo.mouse_move_relative(100, 100);
|
|
|
|
thread::sleep(wait_time);
|
|
|
|
|
|
|
|
enigo.mouse_up(MouseButton::Left);
|
|
|
|
thread::sleep(wait_time);
|
|
|
|
|
|
|
|
enigo.mouse_click(MouseButton::Left);
|
|
|
|
thread::sleep(wait_time);
|
|
|
|
|
|
|
|
enigo.mouse_scroll_x(2);
|
|
|
|
thread::sleep(wait_time);
|
|
|
|
|
|
|
|
enigo.mouse_scroll_x(-2);
|
|
|
|
thread::sleep(wait_time);
|
|
|
|
|
|
|
|
enigo.mouse_scroll_y(2);
|
|
|
|
thread::sleep(wait_time);
|
|
|
|
|
|
|
|
enigo.mouse_scroll_y(-2);
|
|
|
|
thread::sleep(wait_time);
|
|
|
|
}
|