【问题标题】:How to program keystrokes on a single app in Windows after minimizing?最小化后如何在 Windows 中的单个应用程序上编程击键?
【发布时间】:2017-09-04 22:57:29
【问题描述】:

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

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

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

【问题讨论】:

    标签: autohotkey minimize minimized


    【解决方案1】:

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

    ControlSend

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

    例子

    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

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

    例子

    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. 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多