To realize n7000r automatic photograph as an example
Method One:
@echo off
set i = 1
echo open Camera
adb shell am start -n "com.android.gallery3d / com.android.camera.CameraLauncher"
: CLICK
:: Delay 2 seconds
ping 127.0.0.1 -n 2> nul
echo click% i% ..., take photo
:: Click the camera button with coordinates 460, 1200, and sleep for 1 second
adb shell input tap 460 1200
adb shell sleep 1
set / a i = i + 1
echo% i%
:: infinite loop direct goto CLICK
:: goto CLICK
if% i% lss 10 goto CLICK
Method Two:
@echo off
:: Set the number of cycles
set a = 10
::turn on camera
echo open Camera
adb shell am start -n "com.android.gallery3d / com.android.camera.CameraLauncher"
for / l %% i in (1 1% a%) do (
echo click %% i, take photo
adb shell input tap 460 1200
:: Delay 2 seconds
ping 127.0.0.1 -n 2> nul
)
pause
DOS Batch Cycle command
Format: for [parameter] percent variable name in (related file or command) do command
Function: Executes a specific command on one or a group of files, a string, or a command result, to achieve the desired result.
Note: When using the for command in a batch file, specify the variable using%%variable instead of%variable. Variable names are case-sensitive, so%i differs from%i.
About: The for command can take parameters with or without parameters, with parameters that support the following parameters:/D/L/r/f
For detailed usage, see: 52265966
Parameter/L (the set represents a sequence of numbers in increments from start to finish.) can use a negative Step)
Format: for/l%variable in (start,step,end) do command [Command-parameters]
The set represents a sequence of numbers in increments from start to finish. You can use a negative Step
Example:
FOR/L%%i in (1,1,5) do @echo%%i-Output 1 2 3 4 5
FOR/L%%i in (1,2,10) do @echo%%i-Output 1,3,5,7,9
FOR/L%%i in (100,-20,1) do @echo%%i-Output 100,80,60,40,20
FOR/L%%i in (1,1,5) do start cmd--open 5 cmd windows
FOR/L%%i in (1,1,5) do MD%%i--Establish a total of 5 folders from the
FOR/L%%i in (1,1,5) do rd/q%%i--Delete a total of 5 folders from the
Sleep unlock wake-up device:
@echo off
set a=2
for /l %%i in (1 1 %a%) do (
echo the %%i time test start!!
adb shell input keyevent 26
adb shell input swipe 370 1250 370 200 1000
adb shell sleep 3
adb shell input keyevent 26
adb shell sleep 3
echothe %%i time test end!!
)
Batch file written with adb shell test