# I Built a Lightweight Macro Recorder in Rust (Mostly with an AI Agent)

> Source: <https://dev.to/blackixxce12/i-built-a-lightweight-macro-recorder-in-rust-mostly-with-an-ai-agent-27f4>
> Published: 2026-08-19 09:01:37+00:00

I got tired of closed-source macro tools. Most of them store macros in binary formats, have poor DPI awareness, and install global keyboard hooks. For a tool that essentially injects input, closed source felt uncomfortable.

So I wrote my own.

`.exe`

, no installer`If`

/ `While`

, variables, and screen conditionsFour approaches, ordered from cheapest to most expensive:

**Windows UI Automation** by name

No coordinates, no thresholds. Works well for normal desktop apps. Almost useless in games that draw their own UI.

**Image search**

You paste a screenshot snippet (Win+Shift+S). I added the ability to restrict the search area. On my 1440p monitor this dropped the average step from ~78 ms to ~7 ms.

**OCR** via the built-in Windows engine

No external models to download.

**Fixed coordinates**

DPI-aware and anchored to the target window.

The majority of the code was written with an AI agent. I directed the architecture, reviewed every part, fixed the non-trivial pieces (especially the image-search optimization and proper DPI handling), and made the design decisions. The final codebase is still normal, readable Rust.

`SendInput`

can be detected by some anti-cheatsNo telemetry, no accounts, no ads.

I’m mainly looking for feedback on the architecture and any better approaches for the image search / OCR parts.

The repository is public:

[[https://github.com/blackixxce12/macro-recorder](https://github.com/blackixxce12/macro-recorder)]
