您的位置:首页 > 编程语言 > Python开发

ADB+Python+CMD实现读书软件的自动翻页

2018-01-26 10:15 337 查看
最近好冷,用手机看电子书,手好冻,干脆写了个简单的python通过ADB命令来实现自动翻页(有些app没有自动翻页功能)。

1、安装手机驱动和ADB软件;

2、python环境变量配置;

3、windows系统下cmd窗口执行python脚本。

具体脚本如下:

# -*- coding: utf-8 -*-
# 通过ADB命令实现自动翻页阅读

import os
import sys
import time
import math
import random

flag = 1
# 计数
numCount = 0
# 实现点击操作
CMD = 'adb shell input tap 1000 1000'
# 实现右滑操作
CMD_ToRight = 'adb shell input swipe 200 1620 1000 1620'
# 实现左滑操作
CMD_ToLeft = 'adb shell input swipe 1000 1620 200 1620'

while(flag != 0):
numCount += 1
time.sleep(random.uniform(15, 20))
print('阅读',numCount,'页')
os.system(CMD_ToLeft)EOF
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: