Jump to content

Check for userinput


Recommended Posts

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.

Link to comment
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
Link to comment
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
 Share

  • Recently Browsing   0 members

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