riceking Posted July 5, 2010 Share Posted July 5, 2010 I just finished the GUI of my script and now its time to finish the script. If anyone can answer some of them it would be great. 1) How do you hold down a key for a certain length in milliseconds. 2) How do you pause between Send()s commands. 3) How do you send combined keystrokes, Left Arrow + Alt. Haha I thought I had more questions, I guess not. Thanks in advance. \ Link to comment Share on other sites More sharing options...
E1M1 Posted July 5, 2010 Share Posted July 5, 2010 1) like that send("{key down}") 2) sleep(1000); 1 sec pause 3)like that send("!{left}") edited Link to comment Share on other sites More sharing options...
riceking Posted July 5, 2010 Author Share Posted July 5, 2010 1) like that send("{key down}")2) sleep(1000); 1 sec pause3)like that send("!{left}")So ! = Alt? Does anyone know the symbol for CTRL. Also what do you mean by key down, any key? Like Right Arrow, You'd just put Send({Right}) and it would hold it? How do you control how long it holds it down for. \ Link to comment Share on other sites More sharing options...
somdcomputerguy Posted July 5, 2010 Share Posted July 5, 2010 Read up here, Send, and this extremely important section of the Help file will most probably answer everything you need to know about Send and were about to ask.. More questions will arise I'm sure, but the Help file covers just about everything. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
riceking Posted July 6, 2010 Author Share Posted July 6, 2010 (edited) Thanks it helped tons. However, how do I send a key for a certain amount of time. I want to send CTRL for $Variable amount of time, how would I get that to work. I don't want it held down, I want to continuously press it for a certain amount of time. Edited July 6, 2010 by riceking \ Link to comment Share on other sites More sharing options...
JohnOne Posted July 6, 2010 Share Posted July 6, 2010 Put it in a loop, loops are another important part of Autoit. Check the time the loop stays alive with TimerInit() and TimerDiff() AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
riceking Posted July 6, 2010 Author Share Posted July 6, 2010 Loops are quite new to me, can you give me an example. \ Link to comment Share on other sites More sharing options...
JohnOne Posted July 6, 2010 Share Posted July 6, 2010 (edited) Sure While 1 ;your code ;your code WEnd EDIT; but you already know that. Edited July 6, 2010 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
riceking Posted July 6, 2010 Author Share Posted July 6, 2010 How would I do a limited time loop instead of the infinite loop. \ Link to comment Share on other sites More sharing options...
Richard Robertson Posted July 6, 2010 Share Posted July 6, 2010 You don't want a loop. I don't know why JohnOne suggested that. Send("{Right down}") Sleep($milliseconds) Send("{Right up}") Link to comment Share on other sites More sharing options...
somdcomputerguy Posted July 6, 2010 Share Posted July 6, 2010 (edited) Alot depends on what $Variable is. One way could be like this.. For $Variable = 1 To 25 Send("{RIGHT}") Sleep(250) Next Edited July 6, 2010 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
riceking Posted July 6, 2010 Author Share Posted July 6, 2010 Loop because I don't want to hold it, I want to press it repeatedly for $Variable time length. $Variable could be 5 seconds. \ Link to comment Share on other sites More sharing options...
somdcomputerguy Posted July 6, 2010 Share Posted July 6, 2010 #include <Timers.au3> $Variable = 5 $timestart = _Timer_Init() Do Send("{RIGHT}") Sleep(250) Until _Timer_Diff($timestart) >= $Variable * 1000 Just a note.. This isn't extremely accurate, but it does work.. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
riceking Posted July 6, 2010 Author Share Posted July 6, 2010 #include <Timers.au3> $Variable = 5 $timestart = _Timer_Init() Do Send("{RIGHT}") Sleep(250) Until _Timer_Diff($timestart) >= $Variable * 1000 Just a note.. This isn't extremely accurate, but it does work.. Thanks, is it okay if I remove the sleep or put it to a really low number such as 1. Can anyone elaborate more on _Timer_Diff and _Timer_Init() \ Link to comment Share on other sites More sharing options...
somdcomputerguy Posted July 6, 2010 Share Posted July 6, 2010 (edited) Without more code, Sleep's lowest effective value is 10.Click here, Timers Management, or read this section in the local Help file. Edited July 6, 2010 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
riceking Posted July 6, 2010 Author Share Posted July 6, 2010 #include <Timers.au3> $Variable = 5 $timestart = _Timer_Init() Do Send("{RIGHT}") Sleep(250) Until _Timer_Diff($timestart) >= $Variable * 1000 Just a note.. This isn't extremely accurate, but it does work.. Doesn't seem to work, goes on endlessly, it doesn't stop after 5 seconds. I looked at that page and it seems quite complex action for a simple repeatly press for 5 seconds. Also it's okay not to put any sleep correct? \ Link to comment Share on other sites More sharing options...
somdcomputerguy Posted July 6, 2010 Share Posted July 6, 2010 Hmm. This works Ok for me. I wouldn't go lower than 100 for a Sleep value, and I would put some Sleep in that loop, but that's me.. #include <Timers.au3> $Variable = 5 $timestart = _Timer_Init() Do ConsoleWrite("RightArrow" & @LF) Sleep(100) Until _Timer_Diff($timestart) >= $Variable * 1000 - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
riceking Posted July 6, 2010 Author Share Posted July 6, 2010 Alright thanks for the help @LF is line feed, what does that do. Also If I want to hold multiple arrow keys down would it be Send("{LEFT down}{UP down}")? \ Link to comment Share on other sites More sharing options...
Developers Jos Posted July 6, 2010 Developers Share Posted July 6, 2010 Alright thanks for the help @LF is line feed, what does that do. Also If I want to hold multiple arrow keys down would it be Send("{LEFT down}{UP down}")?Do you even try to find an answer on any of your questions or are you simply dumping them all here to get them answered?Just locked one of your topics as it is a forbidden subject and my guess is that this is just more of the same..... right? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
riceking Posted July 6, 2010 Author Share Posted July 6, 2010 (edited) I'm not talking about any forbidden games, I'm just asking questions in general. Sorry for any misunderstanding, I'm finding out on my own, experimenting, and posting questions to finish the script ASAP. Sorry for my troubles. Edited July 6, 2010 by riceking \ Link to comment Share on other sites More sharing options...
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