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.
-- Click an image inside a region
-- x, y, w, h: the search area; score: match threshold from 0 to 1; timeoutMs: how long to keep scanning
local x, y, w, h = 0, 400, 1080, 800
local score = 0.85
local timeoutMs = 5000
Snap.screenRefresh()
local region = Region(x, y, w, h)
local param = FindParam.timeout(timeoutMs):mScore(score)
local match = region:find(Asset.image("target_button"), param)
if match then
toast("Found, tapping")
click(match)
wait(300)
else
toast("Image not found")
end