制作一个在程序内执行特定命令的热键(autohotkey)

making a hotkey that does a specific command inside a program (autohotkey)

我可以使用 AutoHotkey 制作一个热键来执行特定程序的特定命令吗???
例如:在记事本中打开字体设置

如果我可以,那怎么办?
因为我似乎找到的只是 运行 一个程序或点击一些 \keyboard 按钮但我可以做更多吗?

您可能正在寻找 WinMenuSelectItem

From the docs: Invokes a menu item from the menu bar of the specified window.

WinMenuSelectItem, WinTitle, WinText, Menu , SubMenu1, SubMenu2, SubMenu3, SubMenu4, SubMenu5, SubMenu6, ExcludeTitle, ExcludeText


因此对于记事本字体示例,字体设置位于记事本菜单的格式>字体中。所以,你可以使用类似的东西:

#IfWinActive ahk_class Notepad  ;If Notepad is active
^q::WinMenuSelectItem, A, , Format, Font    ;Open Format>Font of actitve window
#If

如果记事本处于活动状态,则在 Control+q 上触发命令 window。