Autohotkey - 如果不满足条件则发送默认行为

标签 autohotkey

在 Autohotkey 中,如果 Foxit Reader 处于事件状态,我如何使 NumpadDot 双击,否则发送一个正常的 NumpadDot?

我的(失败的)尝试:

NumpadDot::
  SetTitleMatchMode 2 ; allow partial titles
  IfWinActive, Foxit
      Click 2
  else
      Send {NumpadDot} ; THIS CREATES AN ENDLESS LOOP!
Return

最佳答案

我推荐@RobertIlbrink 的回答,但这是另一种方法。

$NumpadDot::
IfWinActive, Foxit
    Click 2
else
    SendInput {NumpadDot}
return

$ 防止 AutoHotkey 将发送的按键(通过发送命令)与用户的按键混淆。如果我们不这样做,我们将陷入无限循环。

关于Autohotkey - 如果不满足条件则发送默认行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15840608/

相关文章:

string - autohotkey 将文本表达式分配给变量

wait - 如何在 AHK 中编写一个脚本来粘贴文本,等待一分钟,然后再次粘贴?

autohotkey - 配置Autohotkey以使用Notepad++编辑脚本

autohotkey - 如何将 AutoHotKey 代码设置为仅在 chrome 中运行?

autohotkey - 如何在 AutoHotkey 中找到关联数组的长度?

javascript - 如何在 AutoHotKey 中解析 HTML?

compiler-errors - AutoHotKey throw 错误: Unexpected “}” although the brackets appear to be correct

autohotkey - 如何通过在 AHK 中按 "any"键来中断循环?

autohotkey - 如何在自动热键消息框文本中插入换行符

cmd - 使用 Autohotkey 启动 Onenote UWP