Python脚本打开记事本并使用pyautogui lib编写

问题描述 投票:0回答:2

我正在尝试创建一个脚本来打开网页并在其中键入内容,但首先我想尝试使用记事本来进行操作

import time
import os
import webbrowser
import pyautogui

os.system("notepad.exe")
#time.sleep(3)
pyautogui.write('Hello world!', interval=0.25)

这是我到目前为止所拥有的。问题在于它仅打开记事本,并且仅在我关闭记事本之后,“ Hello world!”在运行脚本的终端上打印出来。

我在这里想念什么?还有其他方法可以使用python脚本编写文本吗?

谢谢!

python pyautogui
2个回答
0
投票

这称为文件处理


0
投票

您可能想要使用pyautogui的鼠标功能来单击记事本,然后键入它。有关鼠标功能的更多信息,请转到此处:https://automatetheboringstuff.com/2e/chapter20/

© www.soinside.com 2019 - 2024. All rights reserved.