SingleInstance force NoEnv SetBatchLines, -1 transN := 200 ; 透明度 ; ################################# ; GUI ; ###########
#SingleInstance force
#NoEnv
SetBatchLines, -1
transN := 200 ; 透明度
; #################################
; GUI
; #################################
;
Gui, +AlwaysOnTop +ToolWindow -SysMenu -Caption +LastFound
Gui, Margin, 0, 0
WinSet, ExStyle, +0x20 ; 鼠标穿透
WinSet, Transparent, %transN%
Gui, Color, Black
Gui, Font, cWhite s50 bold, Arial
Gui, Add, Text, vHotkeyText Center y20
; #################################
; 绑定按键
; #################################
;
Loop, 95
Hotkey, % "~*" Chr(A_Index + 31), Display
Loop, 24 ; F1-F24
Hotkey, % "~*F" A_Index, Display
Loop, 10 ; Numpad0 - Numpad9
Hotkey, % "~*Numpad" A_Index - 1, Display
Otherkeys := "NumpadDiv|NumpadMult|NumpadAdd|NumpadSub|NumpadEnter|Tab|Enter|Esc|BackSpace|Del|Insert|Home|End|PgUp|PgDn|Up|Down|Left|Right|ScrollLock|CapsLock|NumLock|Pause"
Loop, parse, Otherkeys, |
Hotkey, % "~*" A_LoopField, Display
return
; #################################
; 显示按键
; #################################
;
Display:
If A_ThisHotkey =
Return
mods := "Ctrl|Shift|Alt|LWin|RWin"
prefix =
Loop, Parse, mods, |
if GetKeyState(A_LoopField)
prefix := prefix A_LoopField " + "
if !prefix ; 如果没有组合键则不显示
return
key := SubStr(A_ThisHotkey, 3)
if (key = " ")
key := "Space"
ShowHotkey(prefix key)
FadeOut()
Return
; ===================================================================================
ShowHotkey(Hotkey)
{
GuiControl,, HotkeyText, %Hotkey%
WinGetPos, ActWin_X, ActWin_Y, ActWin_W, ActWin_H, A
text_w := ActWin_W, gui_y := (ActWin_Y+ActWin_H) - 115 - 50
GuiControl, Move, HotkeyText, w%text_w% center
Gui, Show, NoActivate x%ActWin_X% y%gui_y% h115 w%text_w%
}
FadeOut(sleep = 1000)
{
global transN
Sleep, %Sleep%
Gui, +LastFound
Loop, % transN
WinSet, Transparent, % (A_Index - transN - 1) * -1
Gui, Hide
WinSet, Transparent, % transN
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
![[办公]AHK动态显示操作按键](https://www.autoahk.com/wp-content/uploads/2017/02/Peitu25-300x84.jpg)


把23和24行改成这样就可以了
Loop, 77
Hotkey, % “~*” Chr(A_Index+47), Display
运行一下下面的代码就知道了
Loop, 95
MsgBox, % Chr(A_Index + 31) ” “A_Index
定义的这一段这符里有很多非法字符。
我用过后 显示24行出错,, 是什么情况。。
调试一下就知道了