Sign in to follow this  
Followers 0
streetglow

Check for userinput

5 posts in this topic

Hello,

how do I check for userinput?

I only would like to know whether someone pressed arrow up or not...

If he did press arrow up, there should appear a message box. *just doing some training*

I know how to show a message box, but when I do this:

if Send("{UP}") then
    MsgBox(0,"You clicked", "UP")
EndIf

I always get the messagebox.

I hope someone can help me,

thanks in advance.

Streetglow.

Share this post


Link to post
Share on other sites



Thanks a lot, could you please explain me why using the while loop?

Share this post


Link to post
Share on other sites

if you dont use a loop in your program, it will almost immediatly end, so by using a loop the program remains active...

look in the helpfile for more informations about loops

Share this post


Link to post
Share on other sites

In addition to what Gif, The Genius Guin, explained might think about adding a Sleep(100) so the CPU doesn't have a fit running through the loop. Anytime you use a loop it's advised to have a Sleep(100) or greater to make it easier on your CPU. To see what I'm talking about you can let your loop run 5 minutes with and without the Sleep(). So the revised code might could be

#Include <Misc.au3>
While 1
    If _IsPressed('26') Then MsgBox(0,"You clicked", "UP")
    Sleep(100)
WEnd

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