Jump to content
Sign in to follow this  
mikjay

Press enter to continue issue

Recommended Posts

mikjay

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!

Share this post


Link to post
Share on other sites
mikjay

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!

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.