How To Call It
Touch is a global table: call its functions with a dot (Touch.<method>(...)), not a colon. Requires Macro Handler 1.0.51 or later.
Returns the code of the most recent lane failure, or "" when there is none.
Documented for app version 1.0.51 (not on Google Play yet)Updated:
Touch is a global table: call its functions with a dot (Touch.<method>(...)), not a colon. Requires Macro Handler 1.0.51 or later.
In automation flow, chain actions with short wait() intervals and use requestStop() or controlled retry on failure paths.
Takes no arguments. Returns a string.
Lane contract: laneAdd stages up to 10 lanes (more fail with lanes_full). from and to are Points; closer than 0.5 px they form a stationary finger whose finish must be "hold". A moving lane takes legMs 20-30000 ms, legs 0-1000 (0 is endless), turn "reverse" (A→B→A without lifting) or "restart" (A→B, lift, press A again) and finish "release" or "hold"; a counted lane may last at most 600000 ms. Optional returnMs (0 or 20-30000), returnPct (1-100) and holdAtForwardMs/holdAtReturnMs (0-10000) shape "reverse" lanes only. laneStart(tag, background, maxRunMs, order): tag matches ^[A-Za-z0-9:_#.-]{1,64}$ ("seq" is reserved), maxRunMs is 0-86400000 (0 is off), order is "together" (default) or "cycle". laneStatus returns idle, starting, running, holding, paused, recovering, cooldown, completed, stopped, failed or cleanup_failed. laneError returns "" or invalid_args, api_unsupported, lanes_full, lease_busy, service_unavailable, obstructed, touch_queue_pending, display_changed, cleanup_started, invalid_segment or lanes_busy. Lanes run on Android 8.0 (API 26) and later; laneStatus, laneError and sequenceStatus do not count against the Touch rate limit.
It works best together with wait(), Point, SwipeParam, ClickParam, and sometimes a Region result.
The snippet below is a starter pattern that can be applied directly in runtime flow.
if not Touch.laneStart("swipe:demo", true, 0) then
print("lane failed: " .. Touch.laneError())
endFrom 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.
if not Touch.laneStart("swipe:demo", true, 0) then
print("lane failed: " .. Touch.laneError())
endlocal stepOk = true
if not Touch.laneStart("swipe:demo", true, 0) then
print("lane failed: " .. Touch.laneError())
end
if stepOk then
wait(200)
endlocal ok, err = pcall(function()
if not Touch.laneStart("swipe:demo", true, 0) then
print("lane failed: " .. Touch.laneError())
end
end)
if not ok then
print("API step failed: Touch.laneError: " .. tostring(err))
requestStop()
end-- In automation flow, chain actions with short wait() intervals and use requestStop() or controlled retry on failure paths.
local function run_laneerror_step()
if not Touch.laneStart("swipe:demo", true, 0) then
print("lane failed: " .. Touch.laneError())
end
end
local ok, err = pcall(run_laneerror_step)
if not ok then
toast("Step failed")
print(err)
end-- Endless back-and-forth background finger while the script keeps working (Macro Handler 1.0.51 or later)
Touch.laneAdd(Point(540, 1500), Point(540, 900), 400, 0, "reverse", "release")
if Touch.laneStart("swipe:joystick", true, 0) then
for step = 1, 10 do
quickTap(Point(900, 1700))
wait(500)
end
Touch.laneRelease("swipe:joystick", 0)
else
print("lane start failed: " .. Touch.laneError())
end