Ready-to-use Code ExampleRegionAssetSnapFindParam

Click Image in Region

Searches for an image template within a defined screen region and clicks it if found. Asset.image() creates the visual template, Region defines the search area. FindParam lets you configure match sensitivity and timeout.

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 resme tikla / Click image in region
-- Parametreler: x, y, w, h = alan koordinatlari
-- mScore = eslesme hassasiyeti (0-100), timeout = max bekleme ms

local x, y, w, h = 0, 400, 1080, 800
local mScore = 80
local timeout = 5000

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

local match = region:find(Asset.image("hedef_buton"), param)
if match then
  toast("Bulundu, tiklaniyor...")
  quickTap(match)
  wait(300)
else
  toast("Gorsel bulunamadi")
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.