【问题标题】:Issues sending key events to browser window autohotkey向浏览器窗口自动热键发送关键事件的问题
【发布时间】:2021-08-03 22:47:49
【问题描述】:

我正在尝试打开一个网页并将其保存为一个完整的文件。对于自动热键来说,这应该是一项相对容易的任务。出于某种原因,我的脚本没有将关键事件发送到窗口。这是脚本:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn All, StdOut  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Run, www.google.com
WinWaitActive firefox.exe
sleep, 4000
ControlSend, ahk_class MozillaWindowClass, ^s

解决这个问题的更好方法是什么?

【问题讨论】:

  • 既然您正在等待窗口变为活动状态,那么您使用 ControlSend 而不是常规发送是否有原因?
  • 不行还是不行

标签: autohotkey


【解决方案1】:

这是我的解决方案:

Run, www.google.com
WinWaitActive ahk_exe firefox.exe
sleep, 4000
Send ^s

为了让它起作用,主要做了两件事

  1. WinWaitActive条件中的exe名称前包含ahk_exe
  2. 删除了 ControlSend 并将其替换为常规的 Send,因为我们已经在等待窗口被激活

希望这会有所帮助,如果您需要,请随时要求更多说明或帮助

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-02-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-10
    • 1970-01-01
    相关资源
    最近更新 更多