中文简介:AHK QuickCommand 是一段即插即用的 AutoHotkey 脚本片段,通过极简配置,在 GUI 中快速搜索并执行主 AHK 脚本里的函数或命令。
English Introduction: AHK QuickCommand is a plug-and-play AutoHotkey snippet that enables you to instantly search and execute already-existing functions or commands in your scripts with minimal setup.
- 配置简单:只需要在主脚本中引入 AHK QuickCommand.ahk 即可使用。它会自动读取并显示 AHK 脚本中可用的函数,并通过 GUI 提供快速调用入口。
- 快速搜索:输入关键字即可过滤命令。可通过双击或按
Enter执行选中的函数。
- 编辑你现有的 AHK 主脚本,并在脚本顶部引入
AHK QuickCommand.ahk,例如:#Include, C:\Desktop\AHK QuickCommand.ahk - 保存并运行脚本。按下
Capslock + C打开命令 GUI。 - 输入关键字过滤命令。使用方向键选择命令,按
Enter或双击执行选中的函数。
AHK QuickCommand.ahk 默认只保留公开通用的快捷键。为了避免把个人快捷键写进分发文件,你可以在主脚本的 #Include 之后绑定自己的快捷键,并调用 QuickCommandInvoke()。
#Include, C:\Desktop\AHK QuickCommand.ahk
F18::
QuickCommandInvoke("F18")
return可选的触发器名称会用于双击检测。因此,连续按两次同一个自定义快捷键时,可以重复执行上一次运行的命令。
- 需要 AutoHotkey v1.1 或更高版本。
- 命令应按以下格式定义:
; Example Commands
; To Exclude: change "func(){" to "func( ){"
ActionExample(){
MsgBox, You selected Example!
; Replace with your custom function
}#Include, C:\Desktop\AHK QuickCommand.ahk建议放在主脚本初始化后会自动运行的启动脚本之后。
- 使用
CapsLock+W/S/Space作为Up/Down/Enter; - 使用
CapsLock+C+C触发上一次执行的命令; - 当匹配到唯一命令时可立即触发,默认关闭;
- 具体功能可以通过修改代码进一步微调。
- Minimal setup: Just include AHK QuickCommand.ahk to use it. Automatically retrieves and displays available functions from your AHK script in a GUI.
- Quick search: Type to filter commands. Trigger by double-click or pressing Enter.
- Edit your existing AHK script and include
AHK QuickCommand.ahkat the top of your main script like this:#Include, C:\Desktop\AHK QuickCommand.ahk - Save and run the script. Press
Capslock + Cto open the GUI. - Type to filter commands. Use arrow keys to navigate, and press
Enteror double-click to execute the selected function.
AHK QuickCommand.ahk only ships with the default public hotkeys. To keep personal shortcuts out of the distributable file, bind your own hotkeys in your main script after #Include and call QuickCommandInvoke().
#Include, C:\Desktop\AHK QuickCommand.ahk
F18::
QuickCommandInvoke("F18")
returnThe optional trigger name is used for double-press detection, so pressing the same custom hotkey twice can repeat the last executed command.
- Requires: AutoHotkey v1.1+
- Commands should be defined in the following format:
; Example Commands
; To Exclude: change "func(){" to "func( ){"
ActionExample(){
MsgBox, You selected Example!
; Replace with your custom function
}- The
#Include, C:\Desktop\AHK QuickCommand.ahkshould be placed right after your startup scripts which automatically run after initializing.
- Use
CapsLock+W/S/SpaceasUp/Down/Enter; - Use
CapsLock+C+Cto trigger last executed command; - Trigger immediately when matched command is unique (Off by default);
- Specific features can be fine-tuned by modifying the code.