0

I need to remap some of my keyboard extra keys with AHK. I need a tool or method that when you press a key it shows the code/name of that key.

3 Answers 3

0

You right click the tray icon of AHK, then you select help, and there you have a list of keys and buttons in the "List of keys, mouse buttons and joystick controls" section of help

0

I found this tool: https://www.codeproject.com/Articles/6362/Global-System-Hooks-in-NET

Yes not sure if there is any app better suit for AHK.

0

Use SKAN's scancode scriptlet, found here to get the scancode:

SetFormat, Integer, Hex
Gui +ToolWindow -SysMenu +AlwaysOnTop
Gui, Font, s14 Bold, Arial
Gui, Add, Text, w100 h33 vSC 0x201 +Border, {SC000}
Gui, Show,, % "// ScanCode //////////"
Loop 9
 OnMessage( 255+A_Index, "ScanCode" ) ; 0x100 to 0x108
Return

ScanCode( wParam, lParam ) {
 Clipboard := "SC" SubStr((((lParam>>16) & 0xFF)+0xF000),-2) 
 GuiControl,, SC, %Clipboard%
}

Note: some keys may NOT have scancodes - for example, my keyboard has some special function keys that alter things on the keyboard itself, and don't get sent through to the PC.

If you do get a scancode, you can set the scancode as a hotkey as found here in the the official AHK documentation:

SC159:: ; Replace 159 with your key's value.
MsgBox, %A_ThisHotKey% was pressed.
return

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .