需要修改打开QQ的路径和open的路径 欢迎大佬一起交流
import os,time,win32gui,win32api,win32con
mouse = []
#账号
account = []
#密码
password=[]
#打开应用程序
#按键码
key_map={ “a”: 65, “b”: 66, “c”: 67, “d”: 68, “e”: 69, “f”: 70, “g”: 71, “h”: 72, “i”: 73, “j”: 74,
“k”: 75, “l”: 76, “m”: 77, “n”: 78, “o”: 79, “p”: 80, “q”: 81, “r”: 82, “s”: 83, “t”: 84,
“u”: 85, “v”: 86, “w”: 87, “x”: 88, “y”: 89, “z”: 90,“0”:96,“1”:97,“2”:98,“3”:99,“4”:100,“5”:101,“6”:102,“7”:103,“8”:104,
“9”:105}
a=0
def qq():
a = win32gui.FindWindow(None, “QQ”)
c = win32gui.GetWindowPlacement(a)
# 确定位置后确定偏移量这是用户框的偏移量
return mouse.append(c[4][0] + 154), mouse.append(c[4][1] + 249)
with open(r’C:\Users\ly\Desktop\可用号码.txt’,‘r’) as file:
#读取一行
num = file.readlines()
for i in range(0, len(num)):
os.system(’“C:\Program Files (x86)\Tencent\QQ\Bin\QQScLauncher.exe”’)
time.sleep(1)
qq()
win32api.SetCursorPos([mouse[0], mouse[1]])
#以四个----分割
number_file = num[i]
number_split = number_file.split(r’----’)
time.sleep(1)
for c in range(len(number_split[0])):
account.append(number_split[0][c])
print(account)
for d in range(len(number_split[1])):
password.append(number_split[1][d])
#读取出按键码应该按多少
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0,0)
time.sleep(0.3)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0,0)
for i in range(len(account)):
e=key_map[account[i]]
win32api.keybd_event(e,0,0,0)
time.sleep(0.5)
win32api.keybd_event(e,0, win32con.KEYEVENTF_KEYUP, 0)
#按键TAB
win32api.keybd_event(9, 0, 0, 0)
time.sleep(0.5)
win32api.keybd_event(9,0, win32con.KEYEVENTF_KEYUP, 0)
for i in range(len(password)-1):
e=key_map[password[i]]
win32api.keybd_event(e,0,0,0)
time.sleep(0.2)
win32api.keybd_event(e,0, win32con.KEYEVENTF_KEYUP, 0)
time.sleep(0.3)
#开始按回车键
win32api.keybd_event(13, 0, 0, 0)
time.sleep(0.3)
win32api.keybd_event(13, 0, win32con.KEYEVENTF_KEYUP, 0)
time.sleep(0.7)
account.clear()
password.clear()
time.sleep(10)