Jump to content

Recommended Posts

Posted

Hi,

I just downloaded the Autoit. I have no idea about scripting eventhough I'm a programer. I find it great.

I would like to create my first Script but need to detect the scancode of the pressed key. Is there a way to get the scancode insteade of the keycode?

Thanks

Greg

Posted

AFAIK the keycode is a code related to the 'meaning' of the key while the 'scancode' is related about the hardware position of the key.

E.G.

The key ~ in english keyboard returns (of course) a tilde, but in an italian keyboard will return a backslash! Because keyboards are differents. So the keycode will be different, but the scancode does not.

Posted

<{POST_SNAPBACK}>

I couldn't make this run, gets an error here:

$aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)

but GetAsyncKeyState Api will return the Virtual Keycode. Which API should I call and how, in order to obtain the Scancode. from the Keyboard Layout?

Posted (edited)

May help.

$ikeyvalue = 27;This is just an example for Esc

$a=DllCall('user32.dll','int','MapVirtualKey','int',$ikeyvalue,'int',0)
MsgBox(0,'Scancode','The scancode is ' & @lf & $a[0])


$iscancode = 1;This is just an example for Esc
$a=DllCall('user32.dll','int','MapVirtualKey','int',$iscancode,'int',1)
MsgBox(0,'Scancode','The keyvalue is ' & @lf & $a[0])

VirtualKeyCodes in hex!

Edited by ezzetabi
Posted

get the "unstable" a.k.a. beta and use this API... "MapVirtualKey"

Lar.

<{POST_SNAPBACK}>

Hi, thanks but where do I download this.

Greg

Posted

Thanks Layer, I'll try these out. Just one thing. Do I install this over the old version or do I have to Uninstall it first?

Thanks again

Greg

<{POST_SNAPBACK}>

You can do either. If you install it over the old version you'll keep your settings though.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...