废话不多说,因为精力原因没有继续注释,如果大家有什么不懂得可以一起探讨一下
import win32gui, win32con, win32api, time, os
from pykeyboard import PyKeyboard
#QQ路径
QQpath = '"E:\Program Files\Tencent\QQ\Bin\QQScLauncher.exe"'
def run_qq(zh, mm):
# 启动QQ
os.system(QQpath)
lstime = time.time()
while 1:
ls_hwnd = win32gui.GetForegroundWindow()
if win32gui.GetWindowText(ls_hwnd) == 'QQ' and win32gui.GetClassName(ls_hwnd) == 'TXGuiFoundation':
print(2, time.time() - lstime)
break
time.sleep(1)
# win32gui.SetForegroundWindow(ls_hwnd)
win32api.keybd_event(16, 0, 0, 0)
# time.sleep(0.1)
win32api.keybd_event(9, 0, 0, 0)
win32api.keybd_event(9, 0, win32con.KEYEVENTF_KEYUP, 0)
time.sleep(0.1)
win32api.keybd_event(16, 0, win32con.KEYEVENTF_KEYUP, 0)
time.sleep(0.5)
into = PyKeyboard()
for i in zh:
into.t