Ready-to-use Code ExampleTouchPoint

Advanced Swipe with Touch API

Step-by-step controlled swipe using Touch.down/move/up. Suitable for joystick control, precise dragging, and multi-finger gestures. The pointer id (0-9) enables multi-touch.

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.

-- Advanced swipe with Touch
-- pointer: finger id (0-9)

local pointer = 0
local startPoint = Point(540, 1200)
local endPoint = Point(540, 600)
local steps = 10
local stepDelayMs = 30

-- Press the finger
Touch.down(startPoint, pointer)
wait(50)

-- Move in small steps for a smooth path
for i = 1, steps do
  local x = startPoint:getX() + (endPoint:getX() - startPoint:getX()) * i / steps
  local y = startPoint:getY() + (endPoint:getY() - startPoint:getY()) * i / steps
  Touch.move(Point(x, y), pointer)
  wait(stepDelayMs)
end

-- Lift the finger
Touch.up(pointer)
toast("Touch swipe finished")

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.