Sign in to follow this  
Followers 0
leuce

Which key did I press?

4 posts in this topic

G'day everyone

Background: I have a new laptop with a slightly weird keyboard layout, and I would like to remap a few keys. Specifically, the left Shift key is halfsized and has a pipe+backslash key next to it (which I want to remap to Shift). Also, there are *two* identical pipe+backslash keys on the keyboard (one next to Shift, and one next to Enter), and I'm hoping that I would be able to remap them individually (to two different functions). Finally, the spacebar is really small, and I hope to remap the AltGr to space so as to extend the space bar a bit.

Need: I need to find out what is the key code for the keys that I want to remap. Is there a way to find out what the key code of a key is when I press the key, without turning the question into a keylogger question? I used to be able to do this but I can't remember how (and I didn't save that script).

Thanks

Samuel (leuce)

Share this post


Link to post
Share on other sites



MSDN can usually prove helpful in cases like these.

A stupidly simple way just to figure it out, however, exists within Misc.au3:

#Include <Misc.au3>

While 1
    For $i = 0 To 400 ;Arbitrary random number
        If _IsPressed(Hex($i)) Then MsgBox(0,0,$i & " " & Hex($i))
    Next
    Sleep(100)
Wend

Share this post


Link to post
Share on other sites

What type of keyboard is it? Sometimes you can get the info on their keycodes in a google search. Would make your coding a lot easier and quicker.

Thanks for the response. Actually, I figured out that AHK might do a better job of remapping, and then I discovered that AHK has a keypress history function that was really useful. It turned out that the two identically looking keys have different codes, so I was able to remap the one next to the Shift key to function as an extension of the Shift key, using AHK.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0