Phenom Posted June 10, 2010 Posted June 10, 2010 How can I get my script to wait for the user to press the enter key?
Phenom Posted June 10, 2010 Author Posted June 10, 2010 Yeah, I can do something like that using Hotkeys but I was wondering if there was another way.
Tvern Posted June 10, 2010 Posted June 10, 2010 There are loads of other ways. For example you could use _IsPressed, or capture the WM_KEYDOWN message, but Hotkeyset seems to do exactly what you asked for, so I see little reason to reïnvent the weel.
sahsanu Posted June 10, 2010 Posted June 10, 2010 (edited) Yeah, I can do something like that using Hotkeys but I was wondering if there was another way.Take a look to _IsPressed function.Edit: Sorry, I didn't see Tvern post Edited June 10, 2010 by sahsanu
Malkey Posted June 10, 2010 Posted June 10, 2010 Like this example.Press Enter to continue script to message box.Notice, no "#Include <Misc.au3>" needed._WaitEnterKey() MsgBox(0, "End of wait", " Enter key pressed") ; Modified from _IsPressed() from Misc.au3 UDF include file. ; Wait for "Enter" key to be pressed. Func _WaitEnterKey() Local $a_R, $vDLL = DllOpen("user32.dll") Do Sleep(10) $a_R = DllCall($vDLL, "short", "GetAsyncKeyState", "int", '0x0D') ; "0D" - Enter key Until $a_R[0] DllClose($vDLL) Return 1 EndFunc ;==>_WaitEnterKey ;
a440hz Posted June 10, 2010 Posted June 10, 2010 Like this example. Press Enter to continue script to message box. Notice, no "#Include <Misc.au3>" needed. _WaitEnterKey() MsgBox(0, "End of wait", " Enter key pressed") ; Modified from _IsPressed() from Misc.au3 UDF include file. ; Wait for "Enter" key to be pressed. Func _WaitEnterKey() Local $a_R, $vDLL = DllOpen("user32.dll") Do Sleep(10) $a_R = DllCall($vDLL, "short", "GetAsyncKeyState", "int", '0x0D') ; "0D" - Enter key Until $a_R[0] DllClose($vDLL) Return 1 EndFunc ;==>_WaitEnterKey ; Nice. Any advantages to using this to as opposed to _IsPressed() other than not having to include Misc.au3? I'm specifically thinking about the best way to intercept '0x01' for mouse clicks Are you experienced?
Phenom Posted June 10, 2010 Author Posted June 10, 2010 (edited) Nice. Any advantages to using this to as opposed to _IsPressed() other than not having to include Misc.au3? I'm specifically thinking about the best way to intercept '0x01' for mouse clicksI don't notice a difference. Whatever window is active will still register that an Enter key was pressed. I would like the program to intercept the Enter key so that nothing gets accidentally selected. I'm also interested in a way to intercept mouse clicks so that things don't accidentally get selected. I want to specify points on the screen with the mouse, but clicking the mouse just causes the program to lose focus. What do you plan to do with intercepting mouse clicks, something similar? Edited June 10, 2010 by Phenom
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now