Jump to content
Sign in to follow this  
stlobeli

[ASK]keyboard input

Recommended Posts

stlobeli

anyone knows how to wait for user key strokes and get the value?? just like C++ getch() method.

Edited by stlobeli

Share this post


Link to post
Share on other sites
Gollum

anyone knows how to wait for user key strokes and get the value?? just like C++ getch() method.

_IsPressed ?

Share this post


Link to post
Share on other sites
stlobeli

_IsPressed ?

no, _IsPressed does not wait for user key strokes, instead, it checks if user pressed the key specified in the key parameter,

what i want is, a way to wait for a key press and then get the value of the pressed key. again, like getch() method in C or C++

Share this post


Link to post
Share on other sites
Alek

maybe something like this??

#include <Misc.au3>
$x = 0
$var = 1
Do
if $var = 253 then $var = 1
if _IsPressed(hex($var)) = 1 then 
    $x = 1
Else
    $var = $var+1
EndIf
until $x = 1
msgbox(0,"test","Hex number of the button pressed is: " &hex($var,2))
Edited by Alek

[font="Impact"]Never fear, I is here.[/font]

Share this post


Link to post
Share on other sites
stlobeli

maybe something like this??

#include <Misc.au3>
$x = 0
$var = 1
Do
if $var = 253 then $var = 1
if _IsPressed(hex($var)) = 1 then 
    $x = 1
Else
    $var = $var+1
EndIf
until $x = 1
i did try the same logic like yours, but there are times when key press timing doesn't meet the key value in the _IsPressed, causing user to press the key two times or more, any other idea??

Share this post


Link to post
Share on other sites
jvanegmond

It's a long shot.. but you might want to take a look at MouseHook by Larry.

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  

×