Ready-to-use Code ExampleRegionSnapOCR

Click Text in Region

Uses OCR (optical character recognition) to find text within a defined area and clicks it. Region:clickText() combines search and click in a single call.

Copyable Example Code

You can paste this into the code editor; still verify target image, region, color, text, and timing values in your own device flow.

-- Belirli alanda metne tikla / Click text in region
-- Parametreler: aranan metin, alan koordinatlari

local aramaMetni = "Baslat"
local x, y, w, h = 0, 800, 1080, 400

Snap.screenRefresh()
local region = Region(x, y, w, h)
local param = FindParam.timeout(3000)

local result = region:clickText(aramaMetni, param)
if result then
  toast("'" .. aramaMetni .. "' tiklandi")
  wait(300)
else
  toast("Metin bulunamadi: " .. aramaMetni)
end

Implementation and Adaptation Notes

  • Before running, replace sample values such as image names, text, colors, coordinates, and file paths with your own macro values.
  • For examples that use Region or coordinates, retest the target area on different resolutions and DPI values.
  • Tune mScore, timeout, and scan rate in a test macro first, then move the verified values into the production macro.
  • Avoid overly wide Region areas; a tighter area scans faster and reduces false matches.
  • For OCR examples, keep the text area clean; busy backgrounds or very small text can weaken recognition.