Sign in to follow this  
Followers 0
qwert

How to determine a decimal key code?

5 posts in this topic

On the far left of the keyboard is the Left Quote key (the lower case of the tilde key). I want to assign it as a hotkey, but I want to specify it in {ASC xx} format ... as in HotKeySet("{ASC 65}", "Action")

The ascii tables say it's 96 ... but 96 doesn't work. I've searched probably 50 online sources and can find no other code specified. How can I view what code is being sent from the keyboard? Or better, does anyone happen to know what the code is?

Thanks for any help.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

This works for me:

HotKeySet("{`}", "Test")
 
While Sleep(100000)
 
WEnd
 
Func Test()
    Exit
EndFunc

or

HotKeySet("{" & Chr(96) & "}", "Test")

While Sleep(100000)

WEnd

Func Test()
    Exit
EndFunc

If I press Shift + ` the script ends.

I have a German keyboard in the key is left to the backspace key.

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Interesting. Both of those work for me, as well. So, 96 is the right code.

Does this mean that AutoIt has a problem expressing 96 in the {ASC 96} form? Or is there a rule about it that I haven't found?

I wanted to use the ASC specifier because I have other control strings that are set up that way in the script and I just looked right to have the all the same. But not if they don't work, of course.

Thanks for your help.

Share this post


Link to post
Share on other sites

I cannot fully understand why you want to use ASC() but you can use this way maybe:

HotKeySet("{" & Chr(Asc("`")) & "}", "Test")

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

I haven't tested it, but the helpfile tells you to use a leading zero on 2-digit codes, which you are not.

To send the ASCII value A (same as pressing ALT+065 on the numeric keypad)

Send("{ASC 065}")

(When using 2 digit ASCII codes you must use a leading 0, otherwise an obsolete 437 code page is used).

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