0

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

有没有一种方法可以将某些击键和鼠标移动编程到 Windows 上的应用程序中,以便即使在我最小化(或 Alt+Tab 离开)应用程序后这些击键仍能继续运行?

从我在这里找到的类似问题中,创建一个机器人似乎是做到这一点的最佳方法,但是机器人是否可以在最小化的程序上工作(在后台运行)?

4

1 回答 1

0

您可以使用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. 
于 2017-09-06T18:19:59.377 回答