Crate enigo_copy

source ·
Expand description

Enigo lets you simulate mouse and keyboard input-events as if they were made by the actual hardware. It is available on Linux (X11), macOS and Windows.

It can be used for testing user interfaces on different platforms, building remote control applications or just automating tasks for user interfaces unaccessible by a public API or scripting language.

This library is in an early alpha status, the API will change in in the future.

In order to use the library, you only have to know about three things:

A simple DSL is available. It is documented in the dsl module.

Examples

use enigo::*;
let mut enigo = Enigo::new();
//paste
enigo.key_down(Key::Control);
enigo.key_click(Key::Layout('v'));
enigo.key_up(Key::Control);
use enigo::*;
let mut enigo = Enigo::new();
enigo.mouse_move_to(500, 200);
enigo.mouse_down(MouseButton::Left);
enigo.mouse_move_relative(100, 100);
enigo.mouse_up(MouseButton::Left);
enigo.key_sequence("hello world");

Modules

  • DSL parser module

Structs

  • The main struct for handling the event emitting

Enums

Traits

  • Contains functions to simulate key presses and to input text.
  • Contains functions to control the mouse and to get the size of the display. Enigo uses a Cartesian coordinate system for specifying coordinates. The origin in this system is located in the top-left corner of the current screen, with positive values extending along the axes down and to the right of the origin point and it is measured in pixels. The same coordinate system is used on all operating systems.