ApplesauceOS
Read Markdown ↗Download .md

swipe

Simulate a finger-1 swipe between two positions.

js
swipe(x1, y1, x2, y2, duration = 0.3)

Arguments

ArgumentTypeMeaning
x1, y1numberStart in native screen pixels.
x2, y2numberEnd in native screen pixels.
durationnumberSeconds; default 0.3.

Returns

No return value (undefined).

Example

js
const s = getScreenInfo();
const landscape = [3, 4].includes(frontMostAppOrientation());
const w = landscape ? s.height : s.width;
const h = landscape ? s.width : s.height;
swipe(w * 0.5, h * 0.75, w * 0.5, h * 0.3, 0.35);

Notes

Verify the new screen afterward; fractional positions alone do not identify an app control.

All JavaScript APIs · Automation playbook