import pyautogui
from datetime import datetime
import pyperclip
from apscheduler.schedulers.blocking import BlockingScheduler
# def main():
pyautogui.PAUSE = 1 # 设置每一步操作的间隔(秒),可防止操作太快
icon_position = pyautogui.position(x=999, y=1409) # Point(x=999, y=1409)
entry_position = pyautogui.position(x=630, y=1015) # Point(x=630, y=1015)
pyautogui.moveTo(icon_position, duration=0.5) # duration为执行时长,可选
pyautogui.click(icon_position)
pyautogui.moveTo(entry_position, duration=0.5)
pyautogui.click(entry_position)
pyautogui.typewrite([*list('wo '), *list('chaoji '), *list('niu ')],0.1)# 第二个参数为按下每一个字母的间隔,可选
pyautogui.hotkey('ctrl','enter')
pyperclip.copy('哈哈!') # 复制
pyautogui.hotkey('ctrl', 'v') # 按下组合键的方法,ctrl+v粘贴
pyautogui.press('enter') # 按下按键
一开始还可以运行,但是不知道什么时候突然就不行了,出现如下显示
Traceback (most recent call last):
File "E:\pycharm\第一个库\121.py", line 4, in <module>
from apscheduler.schedulers.blocking import BlockingScheduler
File "D:\python\lib\site-packages\apscheduler\schedulers\blocking.py", line 5, in <module>
from apscheduler.schedulers.base import BaseScheduler, STATE_STOPPED
File "D:\python\lib\site-packages\apscheduler\schedulers\base.py", line 18, in <module>
from apscheduler.jobstores.memory import MemoryJobStore
File "D:\python\lib\site-packages\apscheduler\jobstores\memory.py", line 4, in <module>
from apscheduler.util import datetime_to_utc_timestamp
File "D:\python\lib\site-packages\apscheduler\util.py", line 95
w if obj.zone == 'local':
^
SyntaxError: invalid syntax
请求解答