想要通过from
我们想要
源码:
def send_keys(keys,
pause=0.05,
with_spaces=False,
with_tabs=False,
with_newlines=False,
turn_off_numlock=True,
vk_packet=True):
"""Parse the keys and type them"""
keys = parse_keys(
keys, with_spaces, with_tabs, with_newlines,
vk_packet=vk_packet)
for k in keys:
k.run()
time.sleep(pause)
SendKeys = deprecated(send_keys)
这里安静先简单的写了个操作流程,大家可以看看:
from pywinauto.keyboard import send_keys
from pywinauto import Application
import time
app = Application().start('notepad.exe')
# 通过支持的控件输入内容
app['无标题 - 记事本'].Edit.type_keys('测试-安静')
time.sleep(2)
# 回车
send_keys('{ENTER}')
# F5
send_keys('{VK_F5}')
# ctrl+a
send