TextUnderMouse v3: A Macro Recorder That Writes AutoHotkey Code for Almost Any Program
Have you ever used an old-school macro recorder? You record your clicks, play them back, and it works great… until you move the window. Or change your screen resolution. Or plug in a second monitor. Then it happily clicks on empty space. 😊
That’s because those recorders save where you clicked. TextUnderMouse v3 saves WHAT you clicked: “the Save button in the Save As window.” Point at a button, checkbox, text box, or list, pick what it should do, and it writes the AutoHotkey v2 code to do it. Record a few steps and you get one script that runs the whole task.
And yes, it still grabs the text under your mouse. That’s just not the most exciting thing it does anymore.
How the macro recorder works
- Point at a control and press
Ctrl+Shift+G. - Pick an action. You only see actions that control actually supports: Click, Double-click, Set text, Ensure checked, Expand, Select, Read text, and more.
- Test run it. It really performs the action right then and tells you PASS or FAIL. No more finding out a week later.
- Add step, then repeat for the next control.
- Export from the Steps window (
Ctrl+Shift+S). All your steps get merged into one clean script.
Only need one action? Skip the steps and press Copy code. Done.
Code that doesn’t fall over
One thing I’ve learned: timing breaks more automations than anything else. So every script the recorder writes is built to be reliable, not just short.
- It waits for the window, then for the control.
- It checks the control is there and enabled, and stops with a clear message if it isn’t. No silent failures.
- It usually doesn’t move your mouse. Clicks go through the program’s own “press this button” command.
- Checkboxes are guarded. “Ensure checked” looks first and only changes the box if it needs to.
- Every line has a comment explaining what it does. It’s a fantastic way to learn how AutoHotkey talks to other programs.
Here’s what you get when you grab a Save button and choose Click:
winTitle := "Save As ahk_exe notepad.exe" ; if the title changes from run to run, shorten this if !WinWait(winTitle, , 5) ; wait up to 5 s for the window throw Error("Window not found: " winTitle) winEl := UIA.ElementFromHandle(winTitle) ; the top-level window el := winEl.WaitElement({AutomationId: "1", Type: "Button"}, 3000) ; waits up to 3 s if !el ; WaitElement returns false on timeout throw Error("Element not found: Button `"Save`" in " winTitle) if !el.IsEnabled ; a disabled control ignores every action throw Error("Element is disabled: Button `"Save`"") el.Click() ; CLICK - uses the Invoke pattern (no mouse movement)
Built for real-world tasks
- Works in most programs. It uses UI Automation (UIA), the same system Windows uses for screen readers. That covers classic Windows apps, File Explorer, Chrome, Edge, and apps built on them like VS Code and Slack.
- Edit any step. Change its name, action, text, or window, with a live code preview as you type.
- Partial window matching. Window title changes every time you open a new document? Match just part of it and the script keeps working.
- Reorder, rename, Test all. Recorded something out of order? Move it. Test the whole sequence before you export.
- Your steps survive a restart. They’re saved as you go, and you’re asked whether to resume or start fresh.
- Hover help on every button in the recorder, so you’re never guessing what something does.
Plus: grab the text under your mouse
The original feature is still here, and it’s better than ever. Error messages, status bars, labels, buttons: the text that refuses to be highlighted.
- Get text under mouse (
Ctrl+T). Copy it, or open a resizable results window. - Grab all window text (
Ctrl+Shift+T). Every readable string in the window at once. - Reads your browser. Chrome, Edge, and VS Code build their accessibility info on demand. v3 wakes them up first, so you get text instead of “nothing here.”
- Your hotkeys, your choice. Change all four shortcuts, including to mouse buttons.
Who this is for
Anyone who wants to automate a Windows program without spending hours figuring out how to find its buttons. If you’ve ever stared at Window Spy wondering how to click “that button right there,” this gets you from pointing at it to working code in seconds.
New to UIA? Even better. Record something, then read the commented code. You’ll learn more in ten minutes than in an afternoon of documentation.
Requirements
- AutoHotkey v2.0.2+ (x64)
- Windows 10 or newer
- No separate runtime install beyond AHK v2
.ahk with AutoHotkey v2. Version 0.0.3.Changelog
0.0.3 (Initial v3 store listing) Ground-up rebuild on UIA2 + TextFinder. Chromium activation for point and whole-window grabs. Grab Path + Code action picker with Test run, multi-step recording, Edit step, and export. User guide included.
Get TextUnderMouse v3
Flat price. Source package. No Software Licensing activation wall at this tier.
Built by the-Automator.com. Licensed under CC BY 4.0.

