Is it possible to make it appear to a system that a key was pressed, for example I need to make A key be pressed thousands of times, and it is much to time consuming to do it manually, I would like to write something to do it for me, and the only thing I know well enough is Python.
更好的说法是,我需要模拟按键,即不捕获按键。
更多信息(根据要求):
我正在运行 Windows XP,需要将密钥发送到另一个应用程序。
安装pywin32扩展。然后您可以执行以下操作:
import win32com.client as comclt
wsh= comclt.Dispatch("WScript.Shell")
wsh.AppActivate("Notepad") # select another application
wsh.SendKeys("a") # send the keys you want
搜索 WScript.Shell 对象的文档(我相信在所有 Windows XP 安装中默认安装)。你可以开始了here, 也许。
EDIT:发送F11
import win32com.client as comctl
wsh = comctl.Dispatch("WScript.Shell")
# Google Chrome window title
wsh.AppActivate("icanhazip.com")
wsh.SendKeys("{F11}")
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)