tristanm22 Posted June 23, 2014 Posted June 23, 2014 (edited) I'm trying to write a very basic script that will automate a process at work that can be very confusing. anyways it is bascialy just a bunch of keypresses mouse clicks that need to be sent so far it works flawlessly. Except there is a few parts where I need to enter a short field of data. currently I'm using sleep (5000) and just entering the data within 5 seconds. But I'd like to know if there is a simple way to just sleep or pause or something until a key is pressed. I have a msgbox that pops up and says enter this information within within 5 seconds. so what Could I use so instead I could have a msgbox that says please enter "so and so" then press enter to contiune then have the script carry on? I only need to enter data 3 times the rest is just pressing keys and mouse clicking I've played around with some examples the forums and the help file specifafly with hotkey and ispressed but I couldn't figure it out here is a snippet of the code MouseClick("left",164,293,2) Sleep ( 1000) MouseClick("left",471,791,1) Sleep ( 1000) MsgBox(64, "Tag Number", "Please enter Tag number within 5 seconds") Sleep (5000) MouseClick("left",1070,952,1) Sleep ( 4000) MouseClick("left",467,154,2) Edited June 23, 2014 by tristanm22
somdcomputerguy Posted June 24, 2014 Posted June 24, 2014 Welcome to the forum. Please use autoit tags (or use the blue button with an A) around any code you post, it makes the code easier to read. Use the _IsPressed() function, in a Do .. Until loop. Like this: #include <Misc.au3> Local $hDLL = DllOpen("user32.dll") Do ToolTip(" Paused ") Sleep(100) Until _IsPressed("0D", $hDLL) ToolTip("") Put the #include line in the top of your script, with any others, if you have any or not. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
tristanm22 Posted June 24, 2014 Author Posted June 24, 2014 Welcome to the forum. Please use autoit tags (or use the blue button with an A) around any code you post, it makes the code easier to read. Use the _IsPressed() function, in a Do .. Until loop. Like this: #include <Misc.au3> Local $hDLL = DllOpen("user32.dll") Do ToolTip(" Paused ") Sleep(100) Until _IsPressed("0D", $hDLL) ToolTip("") Put the #include line in the top of your script, with any others, if you have any or not. Works great! thanks
somdcomputerguy Posted June 24, 2014 Posted June 24, 2014 You bet. Good luck with your project. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
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