最简单操作安卓手机终端的脚本语言,简单粗暴,缺点就是不支持实体键、判断等功能;大家可以举一反三

android常用操作语法如下:

循环语句(20次)

for /l %%a in (1,1,20) do(
............................................
............................................
)

休眠语句(5秒)

ping -n 5 127.0.0.1

adb shell sleep 1

点击某坐标(x:930 y:496)

adb shell input tap 930 496 #

重启

adb reboot

点击按实体键(BACK键/返回键,其他的键通用百度有,或者自己抓日志查看)

adb shell input keyevent KEYCODE_BACK

adb shell input keyevent 4

6.长按某坐标操作/长按连拍(x:554 y:1756 x1:555 y1:1757 1000ms)

adb shell input swipe 554 1756 555 1757 1000

等待终端连接

adb wait-for-device
 

打开应用(该应用包名:com.android.phone)

adb shell am start com.android.phone

退出应用(该应用包名:com.android.phone)

adb shell am force-stop com.android.phone

注释

@echo

实例1:

@echo 终端自动重启1000次

	for /l %%a in (1,1,1000) do (
	   adb wait-for-device
	   adb reboot
	)

实例2:

@echo 在待机界面,拨号连续进入、输入内容退出20次_享有盛誉之名

for /l %%a in (1,1,20) do (

	adb shell input tap 153 1734 #
	
	adb shell input tap 247 1150 #
	
	adb shell input tap 551 1149 #
	
	adb shell input tap 886 1131 #
	
	adb shell input tap 221 1305 #
	
	adb shell input tap 536 1273 #
	
	adb shell input tap 874 1307 #
	
	adb shell input tap 207 1485 #
	
	adb shell input tap 555 1482 #
	
	adb shell input tap 904 1407 #
	
	adb shell input tap 216 1634 #
	
	adb shell input tap 545 1648 #
	
	adb shell input tap 878 1638 #
	
	ping -n 2 127.0.0.1
    adb shell input keyevent KEYCODE_BACK


 )
 
 
 pause