使用python解锁窗口
我试图在预定义的时间解锁窗口,以便使用鼠标和键盘(pyautogui)运行脚本。 我在pyautogui事件中遇到错误。在密码屏幕上单击()(cx\U冻结错误) 有人能支持我吗 请参阅下面的“我的代码”和错误消息:使用python解锁窗口,python,pyautogui,Python,Pyautogui,我试图在预定义的时间解锁窗口,以便使用鼠标和键盘(pyautogui)运行脚本。 我在pyautogui事件中遇到错误。在密码屏幕上单击()(cx\U冻结错误) 有人能支持我吗 请参阅下面的“我的代码”和错误消息: from datetime import datetime from threading import Timer import subprocess import pyautogui import time x=datetime.today() y=x.replace(day
from datetime import datetime
from threading import Timer
import subprocess
import pyautogui
import time
x=datetime.today()
y=x.replace(day=x.day, hour=10, minute=3, second=0, microsecond=0)
delta_t=y-x
print(f'Script scheduled to run on: {y}')
secs=delta_t.seconds+1
def hello_world():
try:
pyautogui.click(1025,513, 2) # click to show the password box
time.sleep(1)
pyautogui.typewrite("Asdfghjkl;'",2) # Type the password
pyautogui.press('enter') # enter to login.
time.sleep(2)
except:
pass
subprocess.call([r'C:\Users\z142192\Desktop\Programs_Created\StockOverviewScript\UpdateStockOverview.exe']) # Run this script after login.
t = Timer(secs, hello_world)
t.start()
尝试向代码中添加
pyautogui.FAILSAFE=False
。在编程时,可能值得实际读取弹出窗口和错误消息。弹出窗口字面上告诉你该做什么…除了这可能不是这里的答案。我不敢打赌PyAutoGUI能够读取或写入Windows锁屏。@rassar,它已经用FAILSAFE=False进行了尝试,但它不起作用。似乎python代码在单击事件后停止(当密码框出现时)。@Kraay89,请参阅上面对rassar的回答。