了解 Autohotkey Controlsend 命令

Understanding Autohotkey Controlsend command

ControlSend,, test, ahk_exe notepad.exe

上面的工作正常,但下面的不行,它应该在记事本中放大文本。

ControlSend,, ^{+}, ahk_exe notepad.exe

我也试过

ControlSend,, {Control down}+{Control up}, ahk_exe notepad.exe

我不太喜欢记事本,我只是被 controlsend 困住了,我正在尝试理解它。通常它会在触发热键后失去对目标 window 的关注。 Controlsend 中是否有特殊规则,可以在触发命令后将焦点保持在原处?例如将以下内容发送到记事本,将激活它。我认为重点是保持专注。

ControlSend,, ^s, ahk_exe notepad.exe

在最后一个示例中,正在创建一个 window,因此它可能是一个错误的示例,但很多时候在向程序发送简单的标准热键时会出现此问题

谢谢!

使用记事本的 Alt 菜单触发放大命令而不是尝试发送 Control Plus 引导我找到这个解决方案:

WinMenuSelectItem, ahk_exe notepad.exe, , View, Zoom, Zoom In

许多使用快捷方式的命令(例如缩放、保存等)也可以从该菜单中触发。该方法也满足触发时不激活Window的要求。