Created
February 10, 2014 22:17
-
-
Save AnthonyMastrean/8925391 to your computer and use it in GitHub Desktop.
Capture all keys pressed to display in a transparent overlay for use in pair programming or video capture
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
/* | |
------------------------------------------------------- | |
HotShow 1.0 | |
------------------------------------------------------- | |
This program will show any pressed key or combination | |
of keys on screen in a very elegant way. | |
Perfect for people who creates video tutorials | |
and want to show which hotkeys they press during | |
a demostration of the software being used. | |
----[Author]-------------------------------------------------------- | |
This program was created by RaptorX | |
Thanks to Tidbit and Titan for help in some of the functions | |
----[Features]------------------------------------------------------ | |
Right now the program is in its basic form. | |
Features will be added soon, Please read the To Do list | |
----[TODO]---------------------------------------------------------- | |
Customization of: | |
-Background Image | |
-Transparency settings | |
-Fade in/Fade out settings | |
-Window Positioning options | |
-A Function that if the program detects a word instead of a shortcut it will wait for what you typed and then display the whole word/sentence at once. | |
-------------------------------------------------------------------- | |
*/ | |
#SingleInstance Force | |
#NoEnv | |
OnExit, Clean | |
FileInstall, BG-Blue.png, BG-Blue.png, 1 ;Background Image | |
FileInstall, BG-Red.png, BG-Red.png, 1 | |
;These are the windows for the background image, created to be able to create the fade in / fade out effects | |
Gui, +owner +AlwaysOnTop +Disabled +Lastfound -Caption | |
Gui, Color, FFFFFF | |
Gui, Add, Picture,,BG-Red.png | |
WinsetTitle,Background | |
Winset, transcolor, FFFFFF 0 | |
Gui, 2: +Owner +AlwaysOnTop +Disabled +Lastfound -Caption | |
Gui, 2: Color, 026D8D | |
Gui, 2: Font, Bold s15 Arial | |
Gui, 2: Add, Text, Center CWhite W250 vHotkeys, | |
WinsetTitle,HotkeyText | |
Winset, transcolor, 026D8D 0 | |
Gui, Show, Hide | |
Gui, 2: Show, Hide | |
;End of background windows, both are hidden until we press a key | |
;This loop includes all the alphanumerical characters using the ascii code. | |
; Code 32 = Space until code 127 = Delete | |
Loop, 95 | |
{ | |
key := Chr(A_Index + 31) | |
Hotkey, ~*%key%, Display | |
} | |
Loop, 24 ;Support for function Keys F1-F24 | |
{ | |
Hotkey, ~*F%a_index%, Display | |
} | |
Hotkey, ~*Numpad0, Display ;Adding Numpad0 | |
Loop, 9 ;Support for Numpad Numbers | |
{ | |
Hotkey, ~*Numpad%a_index%, Display | |
} | |
NumpadKeys=NumpadDiv,NumpadMult,NumpadAdd,NumpadSub,NumpadEnter ; Support for Numpad operands. | |
Loop, Parse, NumpadKeys,`, | |
{ | |
Hotkey, ~*%a_loopfield%, Display | |
} | |
Otherkeys=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 | |
} | |
Display: | |
If A_ThisHotkey = | |
Return | |
;Msgbox, %a_thishotkey% | |
mods = Ctrl,Shift,Alt,LWin,RWin | |
prefix = | |
Loop, Parse, mods,`, | |
{ | |
GetKeyState, mod, %A_LoopField% | |
If mod = D | |
prefix = %prefix%%A_LoopField% + | |
} | |
StringTrimLeft, key, A_ThisHotkey, 2 | |
if key=%a_Space% | |
key=Space | |
Gosub, Show | |
Return | |
Show: | |
Alpha=0 | |
Duration=150 | |
Imgx=23 | |
Imgy=630 | |
GuiControl, 2: Text, Hotkeys, %prefix% %key% | |
Gui, Show, x%imgx% y%imgy% NoActivate | |
imgx-=10 | |
imgy+=15 | |
Gui, 2: Show, x%imgx% y%imgy% NoActivate | |
Gosub, Fadein | |
Sleep 2000 | |
Gosub, Fadeout | |
Gui, Hide | |
Gui, 2: Hide | |
Return | |
Fadein: | |
If faded=1 ;Do not fade if the window already faded in. | |
{ | |
Winset, transcolor, FFFFFF 255, Background | |
Winset, transcolor, 026D8D 255, HotkeyText | |
return | |
} | |
Loop, %duration% ; Fade in routine. | |
{ | |
Alpha+=255/duration | |
Winset, transcolor, FFFFFF %Alpha%, Background | |
Winset, transcolor, 026D8D %Alpha%, HotkeyText | |
faded=1 | |
} | |
Return | |
Fadeout: | |
Loop, %duration% ; Fade out routine | |
{ | |
Alpha-=255/duration | |
Winset, transcolor, FFFFFF %Alpha%, Background | |
Winset, transcolor, 026D8D %Alpha%, HotkeyText | |
faded=0 | |
} | |
return | |
Clean: | |
FileDelete, *.png | |
ExitApp | |
~*Esc::Goto, Clean | |
Pause::Suspend, toggle | |
/* | |
-[Created By]------------------------------------------------------- | |
-RaptorX- | |
This project can be modified or copied, for personal or commercial | |
uses provided that you mention the original author. | |
-------------------------------------------------------------------- | |
*/ |
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
; KeypressOSD.ahk | |
;---------------------------------------------------------- | |
; KeypressOSD v1.00 | |
; Author : tmplinshi | |
; Date : 2013-10-11 | |
; Tested on : Windows XP SP3 / AutoHotkey v1.1.13.00 | |
; Thanks : HotShow.ahk by RaptorX (http://www.autohotkey.com/board/topic/51641-hotshow-10-osd-hotkeys-for-video-tutorials/) | |
;---------------------------------------------------------- | |
#SingleInstance force | |
#NoEnv | |
SetBatchLines, -1 | |
ListLines, Off | |
; ################################# | |
; Settings | |
; ################################# | |
; | |
transN := 200 | |
ShowSingleKey := True | |
DisplayTime := 2000 | |
; ################################# | |
; Create GUI | |
; ################################# | |
; | |
Gui, +AlwaysOnTop -Caption +Owner +LastFound +E0x20 | |
Gui, Margin, 0, 0 | |
Gui, Color, Black | |
Gui, Font, cWhite s50 bold, Arial | |
Gui, Add, Text, vHotkeyText Center y20 | |
WinSet, Transparent, %transN% | |
; ################################# | |
; Create hotkey | |
; ################################# | |
; | |
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 | |
^!MButton::ShowSingleKey := !ShowSingleKey ; Toggle ShowSingleKey | |
; ################################# | |
; Display | |
; ################################# | |
; | |
Display: | |
If (A_ThisHotkey = "") | |
Return | |
mods := "Ctrl|Shift|Alt|LWin|RWin" | |
prefix := "" | |
Loop, Parse, mods, | | |
if GetKeyState(A_LoopField) | |
prefix .= A_LoopField " + " | |
if (!prefix && !ShowSingleKey) | |
return | |
key := SubStr(A_ThisHotkey, 3) | |
if (key = " ") | |
key := "Space" | |
if ( ShowHotkey(prefix key) = "Error" ) | |
Return | |
NewHotkeyPressed := True | |
SetTimer, FadeOut, -1 | |
Return | |
FadeOut: | |
Gui, +LastFound | |
Loop | |
{ | |
NewHotkeyPressed := False | |
WinSet, Transparent, % transN | |
Sleep, %DisplayTime% | |
Loop, % transN | |
{ | |
if NewHotkeyPressed | |
Break | |
WinSet, Transparent, % (A_Index - transN) * -1 | |
} | |
if !NewHotkeyPressed | |
Break | |
} | |
Gui, Hide | |
Return | |
; =================================================================================== | |
ShowHotkey(Hotkey) | |
{ | |
GuiControl,, HotkeyText, %Hotkey% | |
WinGetPos, ActWin_X, ActWin_Y, ActWin_W, ActWin_H, A | |
if !ActWin_W | |
Return "Error" | |
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% | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sources