timer.rs 490 B

1234567891011121314151617181920212223
  1. use enigo::{Enigo, Key, KeyboardControllable};
  2. use std::thread;
  3. use std::time::Duration;
  4. use std::time::Instant;
  5. fn main() {
  6. thread::sleep(Duration::from_secs(2));
  7. let mut enigo = Enigo::new();
  8. let now = Instant::now();
  9. // write text
  10. enigo.key_sequence("Hello World! ❤️");
  11. let time = now.elapsed();
  12. println!("{:?}", time);
  13. // select all
  14. enigo.key_down(Key::Control).ok();
  15. enigo.key_click(Key::Layout('a'));
  16. enigo.key_up(Key::Control);
  17. }