Tuesday, August 5, 2008

AHK - Scan Code Finder

A short script that creates a listview that will record the scan codes of the keys you press. Credits to Krogdor for creating this method of finding the scan code of pressed keys.
#InstallKeybdhook
#NoTrayIcon

Gui, Add, ListView, r20 w150 h125 NoSort Readonly, SC
Gui, Show, Autosize
Loop 9
OnMessage( 255+A_Index, "ScanCode" ) ; 0x100 to 0x108
Return

ScanCode( wParam, lParam ) {
Static Prev := 0
If (Prev != SubStr((((lParam>>16) & 0xFF)+0xF000),-2)) {
LV_Insert(1,"Focus Select","SC" SubStr((((lParam>>16) & 0xFF)+0xF000),-2))
LV_Modify(2,"-Select")
}
Prev := SubStr((((lParam>>16) & 0xFF)+0xF000),-2)
}

GuiClose:
ExitApp

No comments: