1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- #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
- ; #################################
- ; 绑定按键
- ; #################################
- ;重复95次,A_Index表示第i次,默认0。Chr(32)表示空格
- Loop, 95
- Hotkey, % "~*" Chr(A_Index + 32), 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
- }
|