Batch file written with adb shell test

Source: Internet
Author: User
Tags goto mongodb postgresql
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


Alibaba Cloud Hot Products

Elastic Compute Service (ECS) Dedicated Host (DDH) ApsaraDB RDS for MySQL (RDS) ApsaraDB for PolarDB(PolarDB) AnalyticDB for PostgreSQL (ADB for PG)
AnalyticDB for MySQL(ADB for MySQL) Data Transmission Service (DTS) Server Load Balancer (SLB) Global Accelerator (GA) Cloud Enterprise Network (CEN)
Object Storage Service (OSS) Content Delivery Network (CDN) Short Message Service (SMS) Container Service for Kubernetes (ACK) Data Lake Analytics (DLA)

ApsaraDB for Redis (Redis)

ApsaraDB for MongoDB (MongoDB) NAT Gateway VPN Gateway Cloud Firewall
Anti-DDoS Web Application Firewall (WAF) Log Service DataWorks MaxCompute
Elastic MapReduce (EMR) Elasticsearch

Alibaba Cloud Free Trail

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.