非常直截了当的问题。
只想按键盘键。像输入一样,使用pywin auto。我不想在任何应用程序窗口的上下文中按下它。
只需键盘键的原始按键,如输入或退格键。
答案 0 :(得分:6)
只需使用
browserify
文档: https://pywinauto.readthedocs.io/en/latest/code/pywinauto.keyboard.html
P.S。 browserify
已在pywinauto 0.6.0 +中重命名为# from pywinauto.SendKeysCtypes import SendKeys # old for pywinauto==0.5.x
from pywinauto.keyboard import send_keys
send_keys('some text{ENTER 2}some more textt{BACKSPACE}', with_spaces=True)
。
答案 1 :(得分:2)
我必须更改include才能使代码正常工作
from pywinauto.keyboard import send_keys, KeySequenceError
send_keys('some text{ENTER 2}some more textt{BACKSPACE}', with_spaces=True)