Jump to content

Press enter to continue issue


mikjay
 Share

Recommended Posts

Howdy folks,

I'm trying to get a portion of my script working, that waits for the user to press enter to continue. It sounds easy enough, but there are 2 places where it shows intermittent behavior.

$dll = DllOpen("C:\Windows\System32\user32.dll") ;Added these lines because it seemed like the key could be sticking
    DllCall($dll,"int","keybd_event","int",0x0D,"int",0,"long",2,"long",0)
    Sleep(50)
    While 1
        If _IsPressed("0D") = 1 then ExitLoop
       Sleep(50)
    WEnd

The first, and most annoying property of this code is that, every once in awile, the script will continue without enter being pressed.

The second, not critical but annoying as well, is that sometimes the enter key will have to be pressed multiple times.

Is there a better way to go about this? It seems simple enough. Thanks!

Link to comment
Share on other sites

MsgBox(0, "","Press enter and continue ;]")

Also, consider HotKeySet register and unregister.

Manadar, thank you for your comments!

I was thinking since I was waiting for user to click an object before pressing enter that a Msgbox could not be open, but it looks like it should work anyway. Thanks!

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...