Ready-to-use Code ExampleRegionSnapOCR

Find Multiple Texts in Region

Searches for multiple text targets simultaneously in a single scan. Region:findMultiText() scans multiple text targets with one Snap.screenRefresh(). The result table contains individual match results for each text.

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.

-- Alanda birden fazla metin ara / Find multiple texts
-- Parametreler: metin listesi, alan koordinatlari

local metinler = {"Baslat", "Durdur", "Ayarlar"}

Snap.screenRefresh()
local region = Region()

local sonuclar = region:findMultiText(metinler)
if sonuclar then
  local i = 1
  while i <= size(sonuclar) do
    local s = sonuclar[i]
    if s then
      toast("Bulundu: " .. metinler[i] .. " -> " .. s:getX() .. "," .. s:getY())
    else
      toast("Bulunamadi: " .. metinler[i])
    end
    i = i + 1
  end
else
  toast("Hiçbir metin bulunamadı")
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.