AHK功能强大,但是也不必过分利用,感觉一些简单的修改键位映射的功能就很好满足,提升不少体验,分享个人常用配置,有这些功能足矣。
特别是常用的AHK调试刷新/解锁键。
;-----------------------------------------------------------
; 调试专用,可以不离开记事本刷新脚本
; 且按键冲突,导致ctrl、alt、shift被锁定按下时
; 万能解锁键 win+q
;-----------------------------------------------------------
^!#q::
+#q::
!#q::
^#q::
#q::
send ^s
Sleep 1000
Reload
send {alt up}
send {shift up}
send {ctrl up}
return
;打开AHK
^!k::
run Notepad D:\软件\AHK文件\AHK常用快捷.ahk
return
;=========================================================
:*:reg::;快捷输入reg自动补全regedit
clipboard = regedit
send,^v
return
;==============通用↓↓↓↓===========================================
;关闭显示器
1. #F2
::
Sleep 1000
; 0x112 为 WM_SYSCOMMAND, 0xF170 为 SC_MONITORPOWER
SendMessage, 0x112, 0xF170, 2,, Program Manager
return
;睡眠
#F4::
DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)
Return
;打开软件/文件夹
;有了feem,还要什么生态
#F::Run "C:\Program Files (x86)\Feem 2018\Feem.exe"
#T::Run "C:\Program Files\Typora\Typora.exe"
#N::Run notepad
#Q::Run D:\DesktopTemporaryWorkspace
Return
#E::Run D:\Appppp
Return
^#e::Run D:\software\everything\Everything-1.4.1.1022.x86\Everything.exe
;进入屏保
#F3:: Run, open Ribbons.scr
;以管理员身份打开cmd命令行
#C::
Run *RunAs cmd ,,max
return
;=========================================================
系统快捷键修改
#z::
send,#k ;win键特殊群体,需要配合send使用
Return
#`::
send #b
return
;没了esc还是很不习惯
;配合shift最小化,小处理,shift也大块,明显
+esc::
WinMinimize, A
return
;明显就是大处理,不要了!
^esc::
send !{F4}
return
^'::Appskey ;右键菜单
return
;=========================================================
;仿Linux编辑器重做习惯
^+z:: send ^y
return
;仿FN键调音量,用于那些没有音量调节的键盘
!F7::SendInput, {Volume_Mute};
!F9::SendInput, {Volume_Up};
!F8::SendInput, {Volume_Down};
;左手复制习惯
^\::^x
^PgUp::^c
^PgDn::^v
;=========================================================
;左手打开emoji
#F1::#.
;指定程序wrod运行,插入公式快捷键太远
#IfWinActive ahk_exe WINWORD.EXE
!x::!=
return
#IfWinActive
;这种操作会与设置alt唤醒菜单栏快捷键的操作冲突
;只推荐临时用
;!c:: send ^c
;return
;!v:: send ^v
;return
;!x:: send ^x
;return
;=========================================================
^F1:: ;打开地址
send,^c
if(InStr(Clipboard, "http")){
;StringReplace, Clipboard, Clipboard, `r`n, , All ;官方去空格,无效!!
StringReplace, Clipboard, Clipboard, %A_Space%, , All
judgeActivate("Edge","msedge")
run %Clipboard%
}
return
;=========================================================
!F1::
send {backspace}
return
!F2::
send {delete}
return
!`::
send ^!{tab}
return
;鼠标侧键
xbutton1::^tab
return
xbutton2::^+tab
return
;=========================================================
;右手滑轮操作
~right & pgup:: send {Wheelup}
~right & pgdn:: send {Wheeldown}
;右手操作 编辑调节用用
~lshift & ~rshift::
send {lbutton}
return
+pgup:: send {Wheelup}{Wheelup}{Wheelup}
+pgdn:: send {Wheeldown}{Wheeldown}{Wheeldown}
!pgup:: send {Wheelup}{Wheelup}{Wheelup}
!pgdn:: send {Wheeldown}{Wheeldown}{Wheeldown}
指定程序修改类,资源管理器、edge、onenote、excel、word、wps
;==============explorer 专用↓↓↓↓===========================================
#IfWinActive ahk_exe explorer.exe
;创建类类ctrl+ shift
;创建快捷方式(组合键学习例子)
^+s::send +{f10}w{down}{enter}
return
;其他操作类ctrl+ alt
;在某个文件夹下面直接打开powershlll
^+!p::send !fr
return
;解压缩
^!q::
send +{f10}q
return
^!z::
send +{f10}z
return
^=::
send ^!=
return
^-::
send ^!-
return
#IfWinActive
;==============edge专用↓↓↓↓===========================================
#IfWinActive ahk_exe msedge.exe
^!r::
PostMessage, 274, 40022
return
!1::
send ^+o
return
!2::
send ^+y
return
!3::
send ^j
return
#IfWinActive
;;==============onenote专用↓↓↓↓===========================================
#IfWinActive ahk_exe onenote.exe
^-::
send ^+!-
return
^=::
send ^+!=
return
; Fix OneNote horizontal scrolling
; source: https://www.reddit.com/r/OneNote/comments/3lybf1/horizontal_scrolling/
~LShift & WheelUp:: ; Scroll left.
ControlGetFocus, fcontrol, A
Loop 5 ; <-- Increase or decrease this value to scroll faster or slower.
SendMessage, 0x114, 0, 0, %fcontrol%, A ; 0x114 is WM_HSCROLL and the 0 after it is SB_LINERIGHT.
return
~LShift & WheelDown:: ; Scroll right.
ControlGetFocus, fcontrol, A
Loop 5 ; <-- Increase or decrease this value to scroll faster or slower.
SendMessage, 0x114, 1, 0, %fcontrol%, A ; 0x114 is WM_HSCROLL and the 1 after it is SB_LINELEFT.
return
#IfWinActive
;==============excel专用↓↓↓↓===========================================
#IfWinActive,ahk_exe EXCEL.EXE
~LShift & WheelUp:: ; Scroll left.
ControlGetFocus, fcontrol, A
Loop 5 ; <-- Increase or decrease this value to scroll faster or slower.
ComObjActive("Excel.application").ActiveWindow.SmallScroll(0,0,0,1)
return
~LShift & WheelDown:: ; Scroll right.
ControlGetFocus, fcontrol, A
Loop 5 ; <-- Increase or decrease this value to scroll faster or slower.
ComObjActive("Excel.application").ActiveWindow.SmallScroll(0,0,1,0)
return
#IfWinActive
;==============word专用↓↓↓↓===========================================
;指定 word 程序运行
#IfWinActive ahk_exe WINWORD.EXE
!z::!=
;打开段落选项
^!p::send !hk{down 6}{enter}
return
;调节比例
;由于word ctrl和-不能同时触发
;为了配合边缘调节比例功能 得统一快捷键
^=::
send ^!]
return
^-::
send ^![
return
!up::
send {up}{up}{up}{up}{up}
return
!down::
send {down}{down}{down}{down}{down}
return
#IfWinActive
;==============wps专用↓↓↓↓===========================================
#IfWinActive ahk_exe wps.exe
^=::
send ^!]
return
^-::
send ^![
return
return
#IfWinActive
;==================↑↑↑=======================================