In this article, we share the example of python to achieve the specific code of the Shake Shake Shack like function, for your reference, the specific content is as follows
#coding=utf-8 from time import sleep, ctime import threading import os import sys import time import subprocess import re #M 2018-08-11 # Terminal operation for a single control command system(func_swipe,func_trap) #If you want to do more than one command, you can just remove the currently executing function and make a judgment in the do method. # Local test equipment MI6 def connectDevcie(): # Check whether the device is connected successfully, if successful return True, otherwise return False try: # Get the device list information and split it with "\r\n". deviceInfo= subprocess.check_output('adb devices').split("\r\n") # The second element is empty if there is no linked device or if the device read fails if deviceInfo[1]=='': return False else: return True except Exception,e: print "Device Connect Fail:",e def getDeviceName(): try: if connectDevcie(): # Get device name deviceInfo= subprocess.check_output('adb devices -l') deviceName=(r'device product:(.*)\smodel',deviceInfo,)[0] return deviceName else: return "Connect Fail,Please reconnect Device..." except Exception,e: print "Get Device Name:",e def system(func_swipe,func_trap): while True: (func_trap)#USB commands control click operations - > point and click operations (func_swipe)#USB commands to control slide operation - > slide up operation #("adb shell input tap 999 1084")#USB command control finger terminal print 'Start %s! %s' %(getDeviceName(),ctime())# Console message output sleep(5)# Video time delay 5 seconds If you want to extend or shorten the duration, just change the parameter. #def move(func): # while True: # print 'Start %s! %s' %(func,ctime()) # sleep(5)
This is the entire content of this article.