///

MatchText Class

A text match object is returned by Region.findText(...), Region.waitForText(...), and Region.clickText(...). Note that Region.readText(...) returns a plain string (or null), not a MatchText.

x

The center X coordinate of the text match.

let region = new Region(0, 0, Screen.getWidth(), Screen.getHeight()); let matchText = region.findText("Play", { mode: "exact", timeout: 3000 }); console.log(matchText.x); // x

y

The center Y coordinate of the text match.

let region = new Region(0, 0, Screen.getWidth(), Screen.getHeight()); let matchText = region.findText("Play", { mode: "exact", timeout: 3000 }); console.log(matchText.y); // y

cx

Alias for the center X coordinate (x).

let region = new Region(0, 0, Screen.getWidth(), Screen.getHeight()); let matchText = region.findText("Play", { mode: "exact", timeout: 3000 }); console.log(matchText.cx); // cx

cy

Alias for the center Y coordinate (y).

let region = new Region(0, 0, Screen.getWidth(), Screen.getHeight()); let matchText = region.findText("Play", { mode: "exact", timeout: 3000 }); console.log(matchText.cy); // cy

text

The OCR text result.

let region = new Region(0, 0, Screen.getWidth(), Screen.getHeight()); let matchText = region.findText("Play", { mode: "exact", timeout: 3000 }); console.log(matchText.text); // "Play"

point

Center point object.

let region = new Region(0, 0, Screen.getWidth(), Screen.getHeight()); let matchText = region.findText("Play", { mode: "exact", timeout: 3000 }); console.log(matchText.point); // Point(cx, cy)

region

Bounding region for the matched text.

let region = new Region(0, 0, Screen.getWidth(), Screen.getHeight()); let matchText = region.findText("Play", { mode: "exact", timeout: 3000 }); console.log(matchText.region); // (x, y, w, h)

click()

Click the center of the matched text.

let region = new Region(0, 0, Screen.getWidth(), Screen.getHeight()); let matchText = region.findText("Play", { mode: "exact", timeout: 3000 }); matchText.click(); // Clicks the center point (cx, cy)