Skip to content

Instantly share code, notes, and snippets.

@syobocat
Created April 14, 2023 02:47
Show Gist options
  • Save syobocat/54eae27d3f84b4ed91f0c0f6b72f9089 to your computer and use it in GitHub Desktop.
Save syobocat/54eae27d3f84b4ed91f0c0f6b72f9089 to your computer and use it in GitHub Desktop.
連射機
// Written on: 2021/08/19
use enigo::*;
use std::{io, thread, time};
fn main() {
let mut interval = 0;
let mut is_ok = false;
while !is_ok {
println!("Time interval (milliseconds): ");
let mut input = "".to_owned();
io::stdin().read_line(&mut input).ok();
if let Ok(x) = input.trim().parse::<u64>() {
interval = x;
is_ok = true;
} else {
println!("Please enter a number.")
}
}
println!("3...");
thread::sleep(time::Duration::from_millis(1000));
println!("2...");
thread::sleep(time::Duration::from_millis(1000));
println!("1...");
thread::sleep(time::Duration::from_millis(1000));
println!("GO!!!");
let mut enigo = Enigo::new();
loop {
enigo.mouse_click(MouseButton::Left);
thread::sleep(time::Duration::from_millis(interval));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment