Ready-to-use Code ExampleSettingDialogImagePickerAsset

Dialog: Image Picker

Uses ImagePicker component to let the user select an image from gallery or macro images. The selected image can be used with Asset.image().

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.

-- Dialog: Gorsel secici / Dialog: Image picker
-- ImagePicker ile kullanicidan gorsel al

local cfg = Setting.builder()
cfg:setTitle("Gorsel Secimi")

cfg:add("hedef1", ImagePicker("hedef1", "Ana hedef gorsel"))
cfg:add("hedef2", ImagePicker("hedef2", "Yedek hedef gorsel"))
cfg:add("eslesme", EditText("85", 1, "Eşleşme oranı (%)"))

Setting.setDialog(cfg:build())
Setting.show()

local hedef1Adi = Setting.get("hedef1") or ""
local hedef2Adi = Setting.get("hedef2") or ""
local eslesme = tonumber(Setting.get("eslesme")) or 85

if hedef1Adi == "" then
  toast("Gorsel secilmedi!")
  requestStop()
end

local param = FindParam.mScore(eslesme)
param:timeout(5000)

Snap.screenRefresh()
local region = Region()

local match = region:find(Asset.image(hedef1Adi), param)
if not match and hedef2Adi ~= "" then
  match = region:find(Asset.image(hedef2Adi), param)
end

if match then
  quickTap(match)
  toast("Gorsel bulundu ve tiklandi")
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.