fn main() {
#[cfg(not(feature = "lite"))]
{
use rustautogui::RustAutoGui;
use std::thread;
use std::time;
let mut rustautogui = RustAutoGui::new(false).unwrap(); let (screen_w, screen_h) = rustautogui.get_screen_size();
rustautogui
.store_template_from_file(
"/home/davor/Pictures/stars.png",
Some((
(0.2 * screen_w as f32) as u32, 0, (0.5 * screen_w as f32) as u32, (0.4 * screen_h as f32) as u32, )),
rustautogui::MatchMode::Segmented,
"stars",
)
.unwrap();
rustautogui
.prepare_template_from_file(
"/home/davor/Pictures/terms.png",
Some((
(0.1 * screen_w as f32) as u32, (0.7 * screen_h as f32) as u32, (0.5 * screen_w as f32) as u32, (0.3 * screen_h as f32) as u32, )),
rustautogui::MatchMode::Segmented,
)
.unwrap();
rustautogui.keyboard_command("win").unwrap();
thread::sleep(time::Duration::from_millis(500));
rustautogui.keyboard_input("chrome").unwrap();
thread::sleep(time::Duration::from_millis(500));
rustautogui.keyboard_command("return").unwrap();
thread::sleep(time::Duration::from_millis(500));
rustautogui.keyboard_multi_key("ctrl", "t", None).unwrap();
thread::sleep(time::Duration::from_millis(500));
rustautogui
.keyboard_input("https://github.com/DavorMar/rustautogui")
.unwrap();
thread::sleep(time::Duration::from_millis(500));
rustautogui.keyboard_command("return").unwrap();
thread::sleep(time::Duration::from_millis(500));
rustautogui
.loop_find_stored_image_on_screen_and_move_mouse(0.95, 1.0, 15, "stars")
.unwrap();
thread::sleep(time::Duration::from_millis(500));
thread::sleep(time::Duration::from_millis(500));
rustautogui.scroll_down(80).unwrap();
rustautogui
.loop_find_image_on_screen_and_move_mouse(0.95, 1.0, 15)
.unwrap();
thread::sleep(time::Duration::from_millis(500));
rustautogui.left_click().unwrap();
}
}