How To Call It
Automation is a singleton global table: call its functions with a dot (Automation.<method>(...)). Requires Macro Handler 1.0.62 or later.
Uses the System block’s Android actions and the Compare block’s device conditions from Lua.
Documented for app version 1.0.64Updated:
Automation is a singleton global table: call its functions with a dot (Automation.<method>(...)). Requires Macro Handler 1.0.62 or later.
Executes a catalogued Android action under the same validation and permission rules; returns true on success and raises an error on failure.
command is the catalogue identifier; args is a table of command-specific fields. Values may be strings, finite numbers or booleans. Unknown commands or fields, missing required values and out-of-range numbers are rejected. Root and Android permissions are still required.
Android Actions mode in the System block uses the same catalogue. No separate action plan is required. Use pcall for deliberate error handling and Automation.check for conditional execution. In 1.0.62, media_control {command="pause"} dispatches an Android media-key pair and set_volume {stream="music", percent=30} verifies the nearest volume step. Media dispatch does not confirm playback; Android audio policies still apply. screen_timeout {duration=30, unit="s"} verifies the saved screen timeout. Units are ms/s/min, default 30 s; at most six decimal places must convert to whole milliseconds (15000–2147483647), without rounding. WRITE_SETTINGS is required; no permission screen opens and physical display turn-off is not guaranteed.
The snippet below is a starter pattern that can be applied directly in runtime flow.
local message = "Ready"
Automation.action("toast", {text = message})From foundation to combined usage, each level is provided as a separate code block so you can copy the level you need and adapt it directly.
local message = "Ready"
Automation.action("toast", {text = message})local message = "Ready"
Automation.action("toast", {text = message})
-- Continue with one focused method on the object.local message = "Ready"
Automation.action("toast", {text = message})
local note = "Automation overview loaded"
print(note)-- Automation.action(command, args?)
local function run_automation_step()
local message = "Ready"
Automation.action("toast", {text = message})
end
local ok, err = pcall(run_automation_step)
if not ok then
toast("Step failed")
print(err)
endlocal message = "Ready"
Automation.action("toast", {text = message})