Expand description
AutoItX’s API, in Rust, on Windows and macOS.
autoitx drives other applications’ user interfaces: keystrokes, mouse,
clipboard, windows, processes. The API is modeled on AutoItX, the DLL
interface to AutoIt v3, so existing AutoIt automation ports over almost
mechanically — but unlike AutoItX, it also runs natively on macOS.
§Platform support
| Backend | How |
|---|---|
| Windows | FFI into AutoItX3_x64.dll, loaded at runtime |
| macOS | Native — Accessibility API, CGEvent, NSPasteboard |
| Linux | Planned |
Capabilities are split three ways:
- The portable core compiles everywhere.
ext::windowsandext::macoshold what only one platform can do. Calling a Windows-only function in a macOS build is a compile error, not a runtime surprise. (Only the module matching the target platform exists in any given build, which is why these are not direct links — browse docs.rs to see both.)recipesexpresses portable intent whose mechanism differs per platform — “wait until the app stops being busy” is one operation, even though Windows polls the cursor shape and macOS probes the Accessibility message timeout.
§Three things this fixes about hand-written AutoIt code
Keystroke injection. Send interprets {}!+^#, so interpolating user
or database data straight into a send string lets that data execute as key
commands. Here, Keys::text escapes by default and the raw form has to be
asked for by name.
Reading the screen through the clipboard. The common idiom — put a
sentinel on the clipboard, copy, then check whether it changed — races with
anything else touching the clipboard. recipes::read_screen_text waits on
the OS clipboard sequence number instead, which cannot race.
Racing several outcomes with no timeout. AutoIt waits on one window at
a time, so “the form closed, or an error appeared, or a block notice did”
gets written as a hand-rolled polling loop that reliably forgets to give
up. AutoIt::wait_for_any takes the timeout as a parameter and reports
which outcome happened.
§Legal
AutoIt and AutoItX are products of AutoIt Consulting Ltd. This project is
not affiliated with, endorsed by, or sponsored by them, and the AutoItX3
DLL is not distributed with this crate. See NOTICE for details on
obtaining it.
Re-exports§
pub use autoit::AutoIt;docsrsor macOS or Windows ormock-loaderpub use autoit::AutoItBuilder;docsrsor macOS or Windows ormock-loaderpub use autoit::MouseButton;docsrsor macOS or Windows ormock-loaderpub use autoit::Session;docsrsor macOS or Windows ormock-loaderpub use autoit::WinCondition;docsrsor macOS or Windows ormock-loaderpub use control::Control;docsrsor Windows ormock-loaderpub use error::Error;pub use error::Result;pub use geometry::PixelCoordSpace;pub use geometry::Point;pub use geometry::Rect;pub use geometry::Size;pub use keys::Keys;pub use options::KeyMap;pub use options::Options;pub use options::ShowState;pub use options::Speed;pub use options::TitleMatchMode;pub use options::WinState;pub use selector::Selector;
Modules§
- autoit
docsrsor macOS or Windows ormock-loader - The automation handle.
- control
docsrsor Windows ormock-loader - Naming a control inside a window.
- error
- What can go wrong.
- ext
- Platform-specific capabilities.
- geometry
- Coordinates, in one space, on every platform.
- keys
- Keystroke sequences, in AutoIt’s
Sendlanguage. - options
- AutoIt’s option table, and the defaults automation silently depends on.
- recipes
docsrsor macOS or Windows ormock-loader - Portable intent, platform-specific mechanism.
- selector
- Naming a window.