Ready-to-use Code ExampleSettingDialogCheckbox

Dialog: Checkbox

Presents on/off options with Checkbox components. Result-table values are real Boolean true/false values, not strings.

Completion, parameter hints and type checking. Installation instructions and downloads are hosted on GitHub.

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: checkbox

local cfg = Setting.builder()
cfg:setTitle("Features")

cfg:add("sound", Checkbox(true, "Sound alert"))
cfg:add("log", Checkbox(false, "Write a log file"))
cfg:add("hud", Checkbox(true, "Show HUD"))
cfg:add("fast", Checkbox(false, "Fast mode"))

local result = cfg:build():show()
if type(result) ~= "table" then return end

-- Checkbox values are real booleans, not "true"/"false" strings.
local soundOn = result["sound"] == true
local logOn = result["log"] == true
local hudOn = result["hud"] == true
local fastMode = result["fast"] == true

if hudOn then
  local hud = Hud(10, 10, 250, 40, false)
  hud:setText("Macro active")
  hud:show()
end

if soundOn then
  System.vibrate(200)
end

toast("Log: " .. tostring(logOn) .. ", fast: " .. tostring(fastMode))

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.