How to read text from the screen into a macro

Screen OCR inside a Windows macro: read a number, a status or a name off any window, then decide what to do with it.

Updated 18 September 2026 · Screen text reading is part of the Pro plan in Myna Recorder; every new account tries it free for 7 days.

1. What read_text does

Most macro tools can click and type but cannot tell what the screen says. read_text reads a rectangle of the screen into a variable, and from there the value can be typed somewhere else, compared, or used in a message:

total = read_text(region=(820, 400, 180, 40), single_line=True)
message_box("The order total was ${total}")

2. Choose a region

Always pass region=(x, y, width, height). Reading the whole desktop scales it down until ordinary interface text is unreadable. A region the size of the field you care about is fast and accurate. single_line=True joins whatever comes back into one line, which is what you want for a number or a name. Each number in the region may be a variable or a sum, so a region can follow a match found with wait_for.

3. Three readers

engine=What it isCosts creditsTravels in an exported program
"builtin"The default. Runs on your computer.NoYes
"tesseract"A second local reader. Reads some screens better and some worse than the built-in one, and takes page_mode= to control how the picture is split into lines. Try it when a read is close but wrong.NoYes
"ai"A transcription model on our server, for text both local readers misread.YesNo

The engine is chosen per step, so one macro can use the free reader everywhere and the AI reader on the one field that matters.

4. Clean and use the result

total = read_text(region=(820, 400, 180, 40)).to_number()
if total < 1000:
    notify("Total looks low: ${total}")

Methods clean what came back; .to_number() is the one you will use most. A blank region stores an empty string and the run carries on, so test the condition you write against a blank as well as a value. The variables dock shows every variable live during a run, which is the quickest way to see what the reader actually returned.

5. When to ask the AI instead

read_text transcribes. To reason about the screen, use ask_ai: "how many rows are red?", "is there an error dialog?". Three roles: "count" returns a number and where each thing is, so the macro can click it; "explain" returns a sentence for a log or a notification; "read" transcribes with the model you chose. Give it a small region for the same reason: a model can count things across a whole desktop that it cannot then locate. Every call costs credits and a run is capped at 60 AI calls. Details are in the manual.

6. Watch for text while a macro runs

A step reads once, where you put it. A watch row set to Ask AI looks throughout the run, or on its own after Start watching, and fires when the answer appears or goes away. It can pop up, send a Telegram or Discord message with a screenshot, or stop the macro. That is how you get told about the "session expired" banner at 3 am without a step for it in every loop.

7. Costs, plans and export

  • Screen text reading and ask_ai are included in the Pro plan, which also comes with 3,000 credits a month. The two local readers never spend a credit.
  • engine="ai", ask_ai and AI watch rows spend credits and block export as a program. A macro that reads with the built-in or Tesseract reader exports fine, with the reader inside the file.
  • Plans and credit packs are on the pricing page.