Ready-to-use Code ExamplePanelDebuggingHUDState

Floating Debug HUD (Panel)

Uses Panel as a debug HUD — shows live script state, remembers the user's drag position, and auto-restores if not explicitly closed. `Panel:isVisible`/`isAvailable`/`getX`/`getY` query state without a Service round-trip (read-only getters do not dispatch Intents and are safe in tight loops).

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.

-- Floating debug HUD / Floating debug HUD
-- Panel state query'leri tight loop guvenli (zero Intent dispatch)

Panel:show()
Panel:setOpacity(0.85)

-- Onceden kaydedilmis pozisyonu geri yukle
local savedX = KV.getNumber("panel_x", 100)
local savedY = KV.getNumber("panel_y", 200)
Panel:setPosition(savedX, savedY)

local iterasyon = 0
while iterasyon < 50 do
  iterasyon = iterasyon + 1

  -- Panel kapatildiysa makroyu durdur
  if not Panel:isAvailable() then
    toast("Panel kapatildi, durduruluyor")
    break
  end

  -- Kullanici Panel'i tasidiysa yeni pozisyonu KV'ye yaz
  local currentX = Panel:getX()
  local currentY = Panel:getY()
  if currentX ~= savedX or currentY ~= savedY then
    KV.set("panel_x", currentX)
    KV.set("panel_y", currentY)
    savedX, savedY = currentX, currentY
  end

  -- Sadece panel gorunurken ekran tarama yap
  if Panel:isVisible() then
    -- ... gercek tarama mantigi burada ...
  end

  sleep(500)
end

Panel:hide()

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.