bobbielongie1

Send() range of numbers one at a time?

4 posts in this topic

#1 ·  Posted

Brand new to Autoit (and any coding)! I've figured out how to use Send() and even rounded up random numbers between a range. But I would like to be able to Send() each whole number in a rang and not just random numbers, one per line. Any help is appreciated!

ie in Notepad:

1
2
3
4

 

etc..

Share this post


Link to post
Share on other sites



#2 ·  Posted

For this you need a loop. Look at ==> For . . . To . . . Next in the help file.

Sleep(5000) ; five second delay

For $i = 2 To 12
    Send($i)
    Send("{ENTER}")
    ; Sleep(500) ; could be used to slow it down
Next

 

Share this post


Link to post
Share on other sites

#3 ·  Posted

Hi.

Use a for next loop. Example:

Local $iStartNumber = 1
Local $iEndNumber = 100
Local $iCurrentNumber = $iStartNumber
For $i = $iStartNumber To $iEndNumber
    Send($iCurrentNumber)
    Send("{ENTER}")
    $iCurrentNumber += 1
Next

Now you have to modify with WinActivate to focus to the notepad. But it will be much more better using ControlSend() instead of Send(). Therefor look into the helpfile.

Conrad


SciTE = 3.6.2.0/full   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win7Pro SP1   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE   H:\...\AutoIt3   H:\...\AutoIt3\Include   H: = Network Drive

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Share this post


Link to post
Share on other sites

#4 ·  Posted

These are both very helpful and glad to see two different ways. Thank you!

Share this post


Link to post
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