#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; 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.
SetTitleMatchMode 2 ;包含指定的文字
; 如果打了分号
#IfWinActive, Eclipse
$;:: send {;}+{Enter}
$^;::send {;}
#IfWinActive
#IfWinActive, ahk_class CabinetWClass
F2::Send {F2}^a
#IfWinActive
脚本说明
这是一段用 AutoHotkey v1 编写的键盘效率优化脚本,通过热键把常用操作映射到更顺手的按键上,减少重复劳动。主要包含两类映射:
- 在 Eclipse 编辑器中,按下
;并配合Shift+Enter会自动补全为;+Enter,便于语句后快速添加分号并换行; - 在文件资源管理器(
CabinetWClass)窗口内,将F2的默认重命名动作增强为^a(先全选文件名主体),方便批量重命名时快速选中名称。
使用提示
脚本通过 #IfWinActive 限定热键仅在指定应用内生效,不影响其他程序。将文件另存为 .ahk 后用 AutoHotkey 运行即可,也可放入开机启动项实现常驻。
v1 / v2 差异提示
该脚本基于 AutoHotkey v1。迁移到 v2 时需注意:#IfWinActive 已更名为 #HotIf,#NoEnv 已被移除(v2 默认不含旧版环境变量兼容逻辑),SendMode 与热键定义方式基本一致。

