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.

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.

-- File read and write

local path = "macro_log.txt"

-- Write (replaces the file)
File.write(path, "Macro started\n")

-- Append lines
for step = 1, 5 do
  File.append(path, "Step " .. step .. " finished\n")
end

-- Read the file back
local content = File.read(path)
if content then
  toast("File content:\n" .. content)
else
  toast("Could not read the file")
end

-- Check that the file exists
if File.exists(path) then
  toast("Log file is present")
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.