Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

rebinding alt-061


  • Please log in to reply
2 replies to this topic
juckto
  • Guests
  • Last active:
  • Joined: --
Hello. I'm an AHK newbie.

Recently I bought a wireless numpad so I can play a computer game on my laptop. The numpad came with three additional buttons that I would like to be able to bind to functions in the game.

The problem is that the numpad doesn't send simple keystrokes that I can rebind via AHK, it sends (what I believe are called) unicode characters. alt-061, alt-040 and alt-041 for = ( ) respectively.

At least that's what I believe it is sending based on the Key History
Posted Image

My attempts at rebinding so far have been dismal failures, and I was hoping someone here could help me out.

VxE
  • Moderators
  • 3622 posts
  • Last active: Dec 24 2015 02:21 AM
  • Joined: 07 Oct 2006
$*~LAlt::
Loop 10
	Hotkey, % "*Numpad" A_Index-1, HandleNum, on
keywait, LAlt ; replace with "Sleep 100" for an alternative
Loop 10
	Hotkey, % "*Numpad" A_Index-1, HandleNum, off
If (Ascii_Unicode_Input = "061")
	msgbox you pressed the equals key!
If (Ascii_Unicode_Input = "040")
	msgbox you pressed the open parenthisesis key!
If (Ascii_Unicode_Input = "041")
	msgbox you pressed the close parenthisesis key!
Ascii_Unicode_Input := ""
return

HandleNum:
Ascii_Unicode_Input .= SubStr( A_ThisHotkey, 0 )
return
This might be a workaround, since I don't think those buttons can be 'held down'. It also hijacks the numberpad momentarily, so if you have other hotkeys bound to the number pad, you may want to put this code in a seperate script that gets run by the other hotkey script. Finally, if you still want to be able to manualy do the alt+numpad thing for special characters, either use the right alt key or sway the 'keywait' line for 'sleep 100' (and wait 1/10 sec after pressing the alt key before entering the char code ;))

juckto
  • Members
  • 1 posts
  • Last active: Jun 01 2008 05:03 AM
  • Joined: 31 May 2008
Thanks!