最小化后如何在 Windows 中的单个应用程序上对击键进行编程



我可以使用AutoHotKey对某些自动化任务进行编程,但它需要打开应用程序窗口。换句话说,我不能 Alt+Tab 离开应用程序,否则自动热键脚本将无法工作。

有没有办法对 Windows 上的应用程序进行某些击键和鼠标移动编程,以便在我最小化(或 Alt+Tab 离开(应用程序后,这些击键仍能继续运行?

从我在这里发现的类似问题中,创建机器人似乎是最好的方法,但是机器人会在最小化的程序(在后台运行(上工作吗?

您可以使用 ControlSendControlClick 将命令发送到特定应用程序。

控件发送

将模拟击键发送到窗口或控件。

例子

ControlSend, Edit1, This is a line of text in the notepad window., Untitled
SetTitleMatchMode, 2
ControlSend, , abc, cmd.exe  ; Send directly to a command prompt window.

控制点击

将鼠标按钮或鼠标滚轮事件发送到控件。

例子

ControlClick, OK, Some Window Title  ; Clicks the OK button
ControlClick, x55 y77, WinTitle  ; Clicks at a set of coordinates. Note the lack of a comma between X and Y.
; The following method may improve reliability and reduce side effects:
SetControlDelay -1
ControlClick, Toolbar321, WinTitle,,,, NA x192 y10  ; Clicks in NA mode at coordinates that are relative to a named control. 

相关内容

最新更新