Read Text
This action is used when you want to read text from a specific region and save it to a variable.
- Result Variable: The name of the variable where the extracted text will be saved. You can then use this in other actions, scripts, or conditions by typing
%VariableName%orgetVar("VariableName"). - Search Region: Restricts where the OCR engine looks for text on the screen. Making this as small as possible improves speed and accuracy. Read more in .
- Language: Which script the reader should expect, Latin, Chinese, Japanese, Korean, or Devanagari. Latin covers English and most European languages and is the default. Only change it for non-Latin text; the wrong script produces gibberish.
- Default Value (On Fail): What to store when nothing is read. Otherwise a failed read stores an empty string. For a counter,
0is a good default.
Filtering Options
- Read Numbers Only: First runs the standard OCR, then removes any character that isn't a digit or common math symbol (keeps
0123456789+-*/= .). Use this for counters, prices, and timers to stop the reader from guessing letters. - Convert to Number: Saves the extracted result into the variable as a true Number type rather than Text. This is required if you want to use the result in math equations or numeric Conditional checks.
- Whitelist: Only allows these characters in the OCR result. Use this when you know exactly what the text should look like (e.g., uppercase letters only).
- Blacklist: Rejects specific characters from the OCR result.
- Scale Factor: Resizes the captured image before OCR runs. Larger values (e.g., 1.5) can help with small text, but too much can blur the image or slow down detection.
1.0is the normal starting point. - Corrections: Lets you fix common OCR mistakes before the result is used. For example, replace
Bwith8orSwith5if your app uses fonts that OCR confuses often.
Code Equivalent
region.readText(options?) returns the text it read as a string, or null if nothing was found.
let region = new Region(100, 200, 300, 80);
// Extract text using available options
let text = region.readText({ readNumbersOnly: false, whiteList: "", blackList: "", scaleFactor: 2.0 });
if (text) {
console.log(text);
}