Scandalous 0 Posted July 24, 2011 For $i = 1 To 99999 Send('d') Sleep(200) Send('d') Sleep(200) Send('a') Sleep(100) Next basically, that is my code as of right now and I want it to press the key 'd' 2 times with a delay and then hit the 'a' key and loop that process. however, when i tried it, it would press 'd' 2 times and then hit 'a' 5 times before looping or some variation of that. Help please! Share this post Link to post Share on other sites
iCode 8 Posted July 24, 2011 Send('d') Sleep(1000) Send('d') Local $a = 0 Do $a += 1 Send('a') Sleep(500) Until $a = 10 FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences)CODE SNIPPITS: Dynamic tab width (set tab control width according to window width) Share this post Link to post Share on other sites
Scandalous 0 Posted July 24, 2011 That didn't work o_O, it pressed d once and then pressed a for around 8 times before stopping. What I want is to press d twice, and then have a pressed once and then loop so it would become d, d, a, d, d, a, d, d, a to etc. Share this post Link to post Share on other sites
Maffe811 0 Posted July 24, 2011 (edited) You could have read the helpfile and figured out how to take that script and re-write it to fit your needs... Here: Local $a = 0;Loop counter variable ;Stuff that is repeated Do $a += 1;Adds 1 to the loop counter Send('d');Sends d Sleep(1000);Waits Send('d');Sends d Sleep(1000);Waits Send('a');Sends a Sleep(1000);Waits Until $a = 10;How many times to loop Edit: What is this for ? Edited July 24, 2011 by Maffe811 [font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler] Share this post Link to post Share on other sites
kylomas 416 Posted July 25, 2011 Scandalous, Just ran the origional code that you posted from the script editor and it worked exactly as you want. Is there something else we need to know? kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Share this post Link to post Share on other sites
Maffe811 0 Posted July 25, 2011 @Kylomas, maybe he did something wrong and it failed ? And to your sig, i have a girlfriend [font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler] Share this post Link to post Share on other sites