#mouse #automation #wrapper #winapi #left #wheel

mouse_automation

A winapi wrapper that provides easy mouse automation

4 releases

Uses old Rust 2015

0.1.3 Jan 8, 2016
0.1.2 Jan 8, 2016
0.1.1 Dec 27, 2015
0.1.0 Dec 27, 2015

#1726 in Hardware support

MIT license

4KB
51 lines

mouse_automation

A winapi wrapper that provides easy mouse automation. Can be used from a variety of languages.

Installation

Rust

Add this to the toml file:

[dependencies]
mouse_automation = "0.1.1"

Example:

extern crate mouse_automation;

fn main() {
    mouse_automation::move_mouse(0, 0, true); // moves mouse to top left corner
}

Functionality

Moving the mouse

mouse_automation.move_mouse(mut x: i32, mut y: i32, abs: bool);

Third parameter should be true for asbolute movement, and false for relative.

Simulating a click

mouse_automation.LEFT.down();  
mouse_automation.LEFT.up();
mouse_automation.RIGHT.down();  
mouse_automation.RIGHT.up();
mouse_automation.MIDDLE.down();  
mouse_automation.MIDDLE.up();

Two commands are needed to simulate a click, the first sends a down event, and the second an up event.

Wheel scrolling

mouse_automation.wheel(movement: u32);

The sign of the parameter indicates the direction of the scrolling.

No runtime deps