Ready-to-use Code ExampleKVProductivityCounterDateTime

Daily Click Counter (KV)

Uses the persistent KV store to track a daily click, run, or event counter. `KV.increment` provides atomic increments — counters survive script restarts. A date-based key (YYYY-MM-DD) keeps a separate count per day.

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.

-- Gunluk tiklama sayaci / Daily click counter
-- KV.increment ile atomik artirma, KV.has ile varlik kontrolu

local today = DateTime():format("YYYY-MM-DD")
local key = "tiklama_" .. today

-- Ilk calistirmada baslat
if not KV.has(key) then
  toast("Yeni gun basliyor: " .. today)
end

-- Atomik artir, yeni toplami al
local total = KV.increment(key, 1)
toast("Bugunki tiklama: " .. total)

-- Belirli esikte uyari
if total == 100 then
  System.vibrate(200)
  System.noti("100 tiklamaya ulasildi", "Bugun: " .. today)
end

-- Tum gun sayaclarini listele
if KV.size() > 7 then
  -- 7 gunden fazla gecmis varsa eski olanlari temizle
  local allKeys = KV.keys()
  toast("Toplam gun sayisi: " .. #allKeys)
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.