rust防锁屏

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use rsautogui::mouse;
use std::thread::sleep;
use std::time::Duration;
use anyhow::{self, Ok};
 
fn run(x: u16) ->Result<(), anyhow::Error>{
    let timeseconds = Duration::from_secs(5);
    mouse::move_to(x, 500);
    sleep(timeseconds);
    Ok(())
}
 
fn main() {
    let mut x: i8 = -1;
    loop {
        if x > 0{
            run(100_u16).unwrap_or_else(|_|{});
        }else{
            run(300_u16).unwrap_or_else(|_|{});
        }
        x = -x ;
    }
     
}

  

posted @ 2023-10-16 10:47  CrossPython  阅读(55)  评论(0)    收藏  举报
点击右上角即可分享
微信分享提示