key.rs 474 B

123456789101112131415161718
  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. enigo.key_down(Key::Shift).ok();
  8. enigo.key_down(Key::Layout('.')).ok();
  9. enigo.key_up(Key::Layout('.'));
  10. enigo.key_up(Key::Shift);
  11. enigo.key_down(Key::Shift).ok();
  12. enigo.key_down(Key::Layout('-')).ok();
  13. enigo.key_up(Key::Layout('-'));
  14. enigo.key_up(Key::Shift);
  15. }