Last active
July 25, 2018 12:04
-
-
Save gustavomdsantos/24d76a9576c03d199584e3638b8b9c3e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NoEnv | |
#SingleInstance force | |
#InstallKeybdHook | |
Global KeyStates, MouseState, ClickCount, IdleDelay, LargeDisplay | |
IdleDelay=2000 | |
LargeDisplay=1 | |
; 0 = Tooltip near mouse pointer | |
; 1 = Big pane at screen bottom | |
If LargeDisplay | |
{ | |
;Initializing GUI | |
;modded func originated from http://www.autohotkey.com/board/topic/8190-osd-function/ | |
SysGet Monitor, Monitor | |
GUIx := MonitorLeft | |
GUIw := MonitorRight - MonitorLeft | |
GUIh := (MonitorBottom - MonitorTop) * GUIw * 0.00003 | |
If (GUIh > ((MonitorBottom - MonitorTop) * 0.3)) | |
GUIh := (MonitorBottom - MonitorTop) * 0.3 | |
opacity=230 | |
fname="Tahoma" | |
fsize:=GUIh * 0.65 ; really, pixel = 0.75 point, but with 0.75 lowercase letter with lower part (like "g") get cut | |
fColor=ffffff | |
bColor=808080 | |
fformat="600" | |
Gui +LastFound +AlwaysOnTop +ToolWindow -Caption | |
Gui Margin, 0, 0 ;pixels of space to leave at the left/right and top/bottom sides of the window when auto-positioning. | |
Gui Color, %bColor% ;changes background color | |
Gui Font, s%fsize% w%fformat%, %fname% | |
Gui Add, Text, c%fColor% Center +0x80 w%GUIw% h%GUIh% BackgroundTrans VblkOsdCtrlName2 xp-3 yp-3 , tesT test test | |
WinSet Transparent, 128 ; 50% semi-transparent | |
} | |
TrayTip %A_ScriptName%, To Exit`, press the Pause key. | |
Loop | |
{ | |
Input SingleKey, L1 V M I B, {LControl}{RControl}{LAlt}{RAlt}{LShift}{RShift}{LWin}{AppsKey}{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}{Del}{Ins}{Capslock}{Numlock}{PrintScreen}{Pause} | |
GetKeyStates() | |
If SingleKey | |
{ | |
SingleKeyText= | |
If (SingleKey==Chr(27)) | |
SingleKeyText=Esc | |
If (GetKeyState("LControl", "P") || GetKeyState("RControl", "P")) | |
{ | |
If (SingleKey==Chr(10) && EnterPressed) | |
SingleKeyText=Enter | |
Else If (SingleKey >= Chr(1) && SingleKey <= Chr(26)) ; With "M" in Input, Ctrl-A through Ctrl-Z correspond to Chr(1) through Chr(26) | |
SingleKeyText := Chr(Asc("A")-1+Asc(SingleKey)) | |
} Else { | |
If (SingleKey==Chr(10)) | |
SingleKeyText=Enter | |
} | |
If Not SingleKeyText { | |
SingleKeyText:=SingleKey | |
isKeyText = true ; is a key from 'a-z' and '0-9', doesn't show in the GUI | |
} Else { | |
ShowKeys(KeyStates . SingleKeyText) | |
isKeyText = false | |
} | |
EnterPressed=0 | |
GoSub ClearMouseState | |
} Else { | |
ShowKeys(SubStr(KeyStates, 1, -3) . (MouseState ? " + " . MouseState : "")) | |
isKeyText = false | |
} | |
If isKeyText | |
SetTimer TooltipOff, % -IdleDelay | |
Else | |
SetTimer, TooltipOff, % -1 | |
} | |
Pause:: | |
ExitApp | |
~*Enter:: | |
EnterPressed=1 | |
return | |
MouseTooltip(){ | |
GetKeyStates() | |
ShowKeys(KeyStates . MouseState) | |
SetTimer ClearMouseState, % -IdleDelay | |
SetTimer TooltipOff, % -IdleDelay | |
} | |
ClearMouseState: | |
MouseState= | |
ClickCount=0 | |
return | |
TooltipOff: | |
If LargeDisplay | |
Gui Hide | |
Else | |
Tooltip | |
return | |
GetKeyStates() { | |
KeyStates := "" | |
. ( GetKeyState("LControl", "P") ? "LControl + " : "" ) | |
. ( GetKeyState("RControl", "P") ? "RControl + " : "" ) | |
. ( GetKeyState("LAlt", "P") ? "LAlt + " : "" ) | |
. ( GetKeyState("RAlt", "P") ? "RAlt + " : "" ) | |
. ( GetKeyState("LShift", "P") ? "LShift + " : "" ) | |
. ( GetKeyState("RShift", "P") ? "RShift + " : "" ) | |
. ( GetKeyState("LWin", "P") ? "LWin + " : "" ) | |
. ( GetKeyState("AppsKey", "P") ? "AppsKey + " : "" ) | |
. ( GetKeyState("F1", "P") ? "F1 + " : "" ) | |
. ( GetKeyState("F2", "P") ? "F2 + " : "" ) | |
. ( GetKeyState("F3", "P") ? "F3 + " : "" ) | |
. ( GetKeyState("F4", "P") ? "F4 + " : "" ) | |
. ( GetKeyState("F5", "P") ? "F5 + " : "" ) | |
. ( GetKeyState("F6", "P") ? "F6 + " : "" ) | |
. ( GetKeyState("F7", "P") ? "F7 + " : "" ) | |
. ( GetKeyState("F8", "P") ? "F8 + " : "" ) | |
. ( GetKeyState("F9", "P") ? "F9 + " : "" ) | |
. ( GetKeyState("F10", "P") ? "F10 + " : "" ) | |
. ( GetKeyState("F11", "P") ? "F11 + " : "" ) | |
. ( GetKeyState("F12", "P") ? "F12 + " : "" ) | |
. ( GetKeyState("Left", "P") ? "Left + " : "" ) | |
. ( GetKeyState("Right", "P") ? "Right + " : "" ) | |
. ( GetKeyState("Up", "P") ? "Up + " : "" ) | |
. ( GetKeyState("Down", "P") ? "Down + " : "" ) | |
. ( GetKeyState("Home", "P") ? "Home + " : "" ) | |
. ( GetKeyState("End", "P") ? "End + " : "" )x | |
. ( GetKeyState("PgUp", "P") ? "PgUp + " : "" ) | |
. ( GetKeyState("PgDn", "P") ? "PgDn + " : "" ) | |
. ( GetKeyState("Del", "P") ? "Del + " : "" ) | |
. ( GetKeyState("Ins", "P") ? "Ins + " : "" ) | |
. ( GetKeyState("BS", "P") ? "BS + " : "" ) | |
. ( GetKeyState("Capslock", "P") ? "Capslock + " : "" ) | |
. ( GetKeyState("Numlock", "P") ? "Numlock + " : "" ) | |
. ( GetKeyState("PrintScreen", "P") ? "PrintScreen + " : "" ) | |
. ( GetKeyState("Pause", "P") ? "Pause + " : "" ) | |
} | |
ShowKeys(text) { | |
If LargeDisplay | |
{ | |
Global blkOsdCtrlName, blkOsdCtrlName2, MonitorLeft, MonitorRight, MonitorBottom, MonitorTop, GUIx, GUIy, GUIh | |
CoordMode Mouse, Screen | |
GUIy := MonitorBottom - (MonitorBottom - MonitorTop) * 0.2 | |
GuiControl Text, blkOsdCtrlName, %text% | |
GuiControl Text, blkOsdCtrlName2, %text% | |
Gui, Show, x%GUIx% y%GUIy% NoActivate | |
} Else { | |
Tooltip % text | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment