Object MethodTouch and ActionsComing soonv1.0.51

Touch.laneStart(tag, background, maxRunMs, order?)

Starts the staged lanes as one group. With background = true it returns true once the fingers are down and the script keeps running; with false it waits until the group finishes or reaches holding.

Documented for app version 1.0.51 (not on Google Play yet)Updated:

Detailed Explanation

This section explains when to use the API, how to call it, and which structures it works best with in production flow.

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.

When To Use It

In automation flow, chain actions with short wait() intervals and use requestStop() or controlled retry on failure paths.

Parameters and Return

Required: tag, background, maxRunMs. Optional: order (omit to pass nil and use the runtime default). Returns a boolean (true or false).

Options and Limits

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.

Best Combined With

It works best together with wait(), Point, SwipeParam, ClickParam, and sometimes a Region result.

Example Usage

The snippet below is a starter pattern that can be applied directly in runtime flow.

Touch.laneAdd(Point(540, 1500), Point(540, 900), 400, 0, "reverse", "release")
local started = Touch.laneStart("swipe:demo", true, 0)

Copyable Progressive Examples

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.

Foundation

Shows the shortest direct way to call the API.

Foundation
Touch.laneAdd(Point(540, 1500), Point(540, 900), 400, 0, "reverse", "release")
local started = Touch.laneStart("swipe:demo", true, 0)

Simple

Wraps the base call with minimal flow control.

Simple
local stepOk = true
Touch.laneAdd(Point(540, 1500), Point(540, 900), 400, 0, "reverse", "release")
local started = Touch.laneStart("swipe:demo", true, 0)
if stepOk then
  wait(200)
end

Practical Flow

A practical pattern for real macros with pcall, logging, and guards.

Practical Flow
local ok, err = pcall(function()
  Touch.laneAdd(Point(540, 1500), Point(540, 900), 400, 0, "reverse", "release")
  local started = Touch.laneStart("swipe:demo", true, 0)
end)

if not ok then
  print("API step failed: Touch.laneStart: " .. tostring(err))
  requestStop()
end

Detailed

This level packages the API into a reusable helper with error reporting.

Detailed
-- In automation flow, chain actions with short wait() intervals and use requestStop() or controlled retry on failure paths.
local function run_lanestart_step()
  Touch.laneAdd(Point(540, 1500), Point(540, 900), 400, 0, "reverse", "release")
  local started = Touch.laneStart("swipe:demo", true, 0)
end

local ok, err = pcall(run_lanestart_step)
if not ok then
  toast("Step failed")
  print(err)
end

Combined

Combines the API with related structures to form a more realistic workflow.

Combined
-- 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