Ready-to-use Code ExampleSettingDialogEditText

Dialog: Text Input

Creates a dialog with text input fields using Setting.builder(). EditText components collect parameters like delay time, target name, etc. Values are read with Setting.get().

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: Metin girisi / Dialog: Text input
-- Setting.builder() ile kullanicidan parametre al

local cfg = Setting.builder()
cfg:setTitle("Makro Ayarlari")

cfg:add("gecikme", EditText("500", 1, "Gecikme (ms)"))
cfg:add("tekrar", EditText("10", 1, "Tekrar sayısı"))
cfg:add("hedef", EditText("buton_ok", 1, "Hedef ismi"))

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

-- Girilen degerleri oku
local gecikme = tonumber(Setting.get("gecikme")) or 500
local tekrar = tonumber(Setting.get("tekrar")) or 10
local hedef = Setting.get("hedef") or "buton_ok"

toast("Gecikme: " .. gecikme .. "ms, Tekrar: " .. tekrar)

-- Degerleri kullan
local i = 1
while i <= tekrar do
  Snap.screenRefresh()
  local r = Region()
  local m = r:find(Asset.image(hedef))
  if m then quickTap(m) end
  wait(gecikme)
  i = i + 1
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.