如何使用 AutoIt 按 "ALT+F4"
How to press "ALT+F4" using AutoIt
我是 AutoIt 的新手。我通过在 AutoIt 中使用以下代码获得 运行 记事本:
Run("notepad.exe")
现在我想使用 "ALT+F4" 退出应用程序。如何用AutoIt工具按"ALT+F4"?
您需要查看 AutoIt 的文档 - 这非常好。
您要找的是:https://www.autoitscript.com/autoit3/docs/functions/Send.htm
请记住,您要确保 window 处于活动状态,或者您的目标是 window。
有了这个,我推荐使用这个:https://www.autoitscript.com/autoit3/docs/functions/ControlSend.htm
ControlSend() works in a similar way to Send() but it can send key
strokes directly to a window/control, rather than just to the active
window.
以下用于按 "ALT+F4" 的代码应该可以在 AutoIt 中使用:
Send("{ALT down}{F4 down}{F4 up}{ALT up}")
或者,
Send("!{F4}")
或者,
Send("!{F4}", 0)
我是 AutoIt 的新手。我通过在 AutoIt 中使用以下代码获得 运行 记事本:
Run("notepad.exe")
现在我想使用 "ALT+F4" 退出应用程序。如何用AutoIt工具按"ALT+F4"?
您需要查看 AutoIt 的文档 - 这非常好。
您要找的是:https://www.autoitscript.com/autoit3/docs/functions/Send.htm
请记住,您要确保 window 处于活动状态,或者您的目标是 window。
有了这个,我推荐使用这个:https://www.autoitscript.com/autoit3/docs/functions/ControlSend.htm
ControlSend() works in a similar way to Send() but it can send key strokes directly to a window/control, rather than just to the active window.
以下用于按 "ALT+F4" 的代码应该可以在 AutoIt 中使用:
Send("{ALT down}{F4 down}{F4 up}{ALT up}")
或者,
Send("!{F4}")
或者,
Send("!{F4}", 0)