我是 AutoIt 的新手。我在 AutoIt 中使用以下代码运行记事本:
Run("notepad.exe")
现在我想使用“ALT+F4”退出应用程序。如何使用 AutoIt 工具按“ALT+F4”?
您需要查看 AutoIt 的文档——这非常好。
您正在寻找的是:https ://www.autoitscript.com/autoit3/docs/functions/Send.htm
请记住,您要确保该窗口处于活动状态或您正在定位该窗口。
有了这个,我建议使用这个:https ://www.autoitscript.com/autoit3/docs/functions/ControlSend.htm
ControlSend() 的工作方式与 Send() 类似,但它可以将击键直接发送到窗口/控件,而不仅仅是发送到活动窗口。
以下用于按“ALT+F4”的代码应该在 AutoIt 中工作:
Send("{ALT down}{F4 down}{F4 up}{ALT up}")
或者,
Send("!{F4}")
或者,
Send("!{F4}", 0)