Created
October 28, 2020 20:58
-
-
Save Cvar1984/5856836894cd26e486911493743fc3cd to your computer and use it in GitHub Desktop.
adb shell input.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --[[-- | |
| Copyright (c) 2020 Ramdhan Firmansyah | |
| File : swipe.lua | |
| Author : Cvar1984 <[email protected]> | |
| Date : 28.10.2020 | |
| Last Modified Date: 28.10.2020 | |
| Last Modified By : Cvar1984 <[email protected]> | |
| --]]-- | |
| exec = os.execute; | |
| local touchscreen = {}; | |
| function touchscreen:tap(x1, y1) | |
| local cmd = string.format('adb shell input tap %d %d', x1, y1); | |
| print(cmd); | |
| exec(cmd); | |
| end | |
| -- <x1> <y1> <x2> <y2> [duration(ms)] (Default: touchscreen) | |
| function touchscreen:swipe(x1, y1, x2, y2) | |
| local cmd = string.format('adb shell input swipe %d %d %d %d', x1, y1, x2, y2); | |
| print(cmd); | |
| exec(cmd); | |
| end | |
| -- <x1> <y1> <x2> <y2> [duration(ms)] Default: touchscreen) | |
| function touchscreen:dragAndDrop(x1, y1, x2, y2) | |
| local cmd = string.format('adb shell input draganddrop', x1, y1, x2, y2); | |
| print(cmd); | |
| exec(cmd); | |
| end | |
| function touchscreen:text(text) | |
| local cmd = string.format('adb shell input text %s', text); | |
| print(cmd); | |
| exec(cmd); | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment