Ready-to-use Code ExampleFile

File Read and Write

File data write, read, and append operations. File.write() writes, File.read() reads, File.append() appends. Used for logging, saving settings, and data sharing.

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.

-- Dosya okuma ve yazma / File read and write
-- Parametreler: dosya yolu, icerik

local dosyaYolu = "macro_log.txt"

-- Dosyaya yaz (ustune yazar)
File.write(dosyaYolu, "Makro basladi\n")

-- Dosyaya ekle
local i = 1
while i <= 5 do
  local satir = "Adım " .. i .. " tamamlandı\n"
  File.append(dosyaYolu, satir)
  i = i + 1
end

-- Dosyayi oku
local icerik = File.read(dosyaYolu)
if icerik then
  toast("Dosya icerigi:\n" .. icerik)
else
  toast("Dosya okunamadi")
end

-- Dosya var mi kontrol et
if File.exists(dosyaYolu) then
  toast("Log dosyasi mevcut")
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.