There seems to be a lot of plug-ins about WeChat jumping on the Internet. Yesterday, I saw someone teaching Python to learn it.
Principle: 1. Take a screenshot of the mobile phone through the adb command,
2. Calculate the distance between two points on the screenshot,
3. Calculate the pressing time of a pixel point and the pressing time is 1.35ms
4. Send the command of pressing time through adb
The adb driver is very important, you need to run the adb driver in cmd first.
After obtaining the screenshot, click the starting point and target point on the right, click the time through the program to obtain the coordinates of the two points, calculate the distance, calculate the pressing time, and use adb to send the pressing command.
Specific adb tools and code address: http://download.csdn.net/download/sinat_37921768/10192092
Note: To determine whether to send a pressing command, it is necessary to confirm that two points are acquired, and after sending the pressing time, clear the last data and refresh the interface. The following is the specific code in Python:
import os import PIL,numpy import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation import time need_update = True def get_screen_image(): os.system('adb shell screencap -p /sdcard/screen.png') os.system('adb pull /sdcard/screen.png') return numpy.array(PIL.Image.open('screen.png')) def jump_to_next(point1,point2): x1,y1 = point1;x2,y2 = point2 distace=((y2-y1)**2+(x2-x1)**2)**0.5 os.system('adb shell input swipe 320 410 320 410 {}'.format(int(distace*1.35))) def on_calck(event,coor=[]): #Bind the mouse click event global need_update coor.append((event.xdata,event.ydata)) if len(coor) == 2: jump_to_next(coor.pop(),coor.pop()) need_update = True def update_screen(frame):#更新图片 global need_update if need_update: time.sleep(0.7) axes_image.set_array(get_screen_image()) need_update = False return axes_image, get_screen_image() figure = plt.figure() axes_image = plt.imshow(get_screen_image(),animated=True) figure.canvas.mpl_connect('button_press_event',on_calck) ani =FuncAnimation(figure,update_screen,interval=50,blit=True)#刷新 plt.show()