Jump to content

Send Key with a loop?


Recommended Posts

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!

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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 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]

Link to comment
Share on other sites

@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]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...