Genymotion
import win32gui
#
# def _MyCallback(hwnd, extra):
# windows = extra
# temp = []
# temp.append(hex(hwnd))
# temp.append(win32gui.GetClassName(hwnd))
# temp.append(win32gui.GetWindowText(hwnd))
# windows[hwnd] = temp
#
#
# windows = {}
# # win32gui.EnumWindows(_MyCallback, windows)
# # hld = win32gui.FindWindow("TXGuiFoundation", '实时加速工具')
# #
# # hldb = win32gui.FindWindow("TXGuiFoundation", '实时加速工具2')
# """
# 手动确定ClassName-WindowText 窗口组名-单独名
# 生成临时文件,检索
# """
# # with open('tmp.txt', 'w', encoding='utf-8') as fo:
# # for i in windows:
# # s = '%s%s%s' % (str(i), str(windows[i]), ' ')
# # fo.write(s)
#
# """
# 8064026['0x7b0c1a', 'BS2CHINAUI', '']
# 201748['0x31414', 'BS2CHINAUI', 'BSCNKEYMAPWND_Android']
# 660380['0xa139c', 'BS2CHINAUI', '']
# 529522['0x81472', 'BS2CHINAUI', '']
# 922564['0xe13c4', 'BS2CHINAUI', 'BlueStacks App Player']
#
# 4390956['0x43002c', 'BS2CHINAUI', 'soui tooltip']
# 988220['0xf143c', 'BS2CHINAUI', 'soui tooltip']
# 660518['0xa1426', 'BS2CHINAUI', 'soui tooltip']
#
#
#
# 133000['0x20788', 'CLASS_BLUESTACKS_ADMODUL', '']
# 198162['0x30612', 'BS2CHINAUI', '']
# 198146['0x30602', 'BS2CHINAUI', '']
# 329388['0x506ac', 'BS2CHINAUI', 'BlueStacks App Player']
#
# 133004['0x2078c', 'CLASS_BLUESTACKS_ADMODUL', 'soui tooltip']
# 198158['0x3060e', 'BS2CHINAUI', 'soui tooltip']
# 198224['0x30650', 'BS2CHINAUI', 'soui tooltip']
# 263744['0x40640', 'BS2CHINAUI', 'soui tooltip']
# """
#
# windowstext = 'BlueStacks App Player'
# hld_a, hld_b = win32gui.FindWindow('BS2CHINAUI', 'BSCNKEYMAPWND_Android'), win32gui.FindWindow('BS2CHINAUI', 'BlueStacks App Player')
# hld_a, hld_b = win32gui.FindWindow('CLASS_BLUESTACKS_ADMODUL', 'soui tooltip'), win32gui.FindWindow('BS2CHINAUI', 'BlueStacks App Player')
"""
以上测试通过
"""
import win32con
"""
tested--0100
"""
# win32gui.ShowWindow(hld_a, win32con.SW_MAXIMIZE)
#
# win32gui.SetForegroundWindow(hld_a)
"""
0100--tested
"""
import time
time.sleep(1)
# win32gui.ShowWindow(hld_b, win32con.SW_MAXIMIZE)
#
# win32gui.SetForegroundWindow(hld_b)
# win32gui.ShowWindow(hld_a, win32con.SW_MAXIMIZE)
#
# win32gui.SetForegroundWindow(hld_a)
import win32api
# inp=[400,400]
# win32api.SetCursorPos(inp) win32.types.error: (126, 'SetCursorPos', '找不到指定的模块。')
from ctypes import windll
# inp=[400,400]
# windll.user32.SetCursorPos(400, 400)
# windll.user32.SetCursorPos(inp) #ctypes.ArgumentError: argument 1: <class 'TypeError'>: Don't know how to convert parameter 1
# win32gui.ShowWindow(hld_b, win32con.SW_MAXIMIZE)
# windll.user32.SetCursorPos(400, 400)
import random
import pyautogui
import time
st=time.time()
x,y=557,631
x,y=693,603
x,y=616,339
# win32api.SetCursorPos([x, y])
# win32gui.SetForegroundWindow(hld_b)
# win32gui.ShowWindow(hld_b, win32con.SW_MAXIMIZE)
# win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0)
# time.sleep(0.05)
# win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0)
# time.sleep(0.05)
# win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0)
# time.sleep(0.05)
# win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0)
#
# win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y)
# time.sleep(0.05)
# win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y)
# time.sleep(0.05)
# win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y)
# time.sleep(0.05)
# win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y)
l=[(667,476),(935,405),(),()]
l=[(667,476),(935,405)]
l=[(476,350),(387,236),(380,653),(658,859),(320,598),(669,184)]
#time.sleep(30)
for i in l:
x,y=i
win32api.SetCursorPos([x, y])
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y)
time.sleep(0.05)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y)
time.sleep(5)
time.sleep(10)
import os
os._exit(123)
dd=9
windows下操纵安卓模拟器 转发动态