import time
import wmi
import win32gui, win32con, time, subprocess, os, win32api
# 进程名
supernotes_process = 'SuperNotes.exe'
def kill_supernotes():
c = wmi.WMI()
for process in c.Win32_Process(name=supernotes_process):
print(process.ProcessId, process.Name)
process.Terminate()
kill_supernotes()
# 路径
supernotes_path = r"C:\Program Files (x86)\Super Notes\SuperNotes.exe"
subprocess.Popen(supernotes_path)
flt = 0
while flt == 0:
try:
hwnd = win32gui.FindWindow(None, "Super Notes 1.7.3.0 B")
print('-'*20, hwnd)
if hwnd:
flt = win32gui.FindWindow("WindowsForms10.Window.8.app.0.165f26b", "登录")
print('-'*22,flt)
except:
print('sleep 0.5')
time.sleep(0.5)
time.sleep(0.5)
edit = win32gui.FindWindowEx(flt, None, "WindowsForms10.EDIT.app.0.165f26b", None)
print('edit', flt)
print('edit', edit)
with open('password.txt', 'r') as f:
password = f.readline().strip()
print(password)
win32gui.SendMessage(edit, win32con.WM_SETTEXT, None, password)
time.sleep(0.1)
login_button = win32gui.FindWindowEx(flt, None, "WindowsForms10.BUTTON.app.0.165f26b", "确 定")
print('login_button', login_button)
# 鼠标左键按下
win32gui.SendMessage(login_button, win32con.WM_LBUTTONDOWN, win32con.MK_LBUTTON, 0)
# 鼠标左键抬起
win32gui.SendMessage(login_button, win32con.WM_LBUTTONUP, win32con.MK_LBUTTON, 0)
print('hello')
def keybd_event(VK_CODE): #VK_CODE为键盘编码
# @Keyboard
# input
VK_CODE = int(VK_CODE)
print (":::VK_CODE:", VK_CODE)
win32api.keybd_event(VK_CODE, 0, 0, 0)
win32api.keybd_event(VK_CODE, 0, win32con.KEYEVENTF_KEYUP, 0)
print (":::press", str(VK_CODE), "successfully!")
time.sleep(1)
for i in range(15):
keybd_event(145)
print('hello')
自动登录supernotes
最新推荐文章于 2021-10-27 18:02:48 发布