keyboard.rs 399 B

1234567891011121314151617
  1. use enigo::{Enigo, Key, KeyboardControllable};
  2. use std::thread;
  3. use std::time::Duration;
  4. fn main() {
  5. thread::sleep(Duration::from_secs(2));
  6. let mut enigo = Enigo::new();
  7. // write text
  8. enigo.key_sequence("Hello World! here is a lot of text ❤️");
  9. // select all
  10. enigo.key_down(Key::Control).ok();
  11. enigo.key_click(Key::Layout('a'));
  12. enigo.key_up(Key::Control);
  13. }