Jump to content
Sign in to follow this  
kforsey

Looping?

Recommended Posts

I got a question, How do you make a loop go from start to finish of a script for X amount of times. Like say I was using the script

Sleep(1000)

Send("Hello")

Send("{ENTER}")

Sleep(1000)

Send("Goodbye")

Send("{ENTER}")

And I wanted it to keep repeating this over and over agin into Notepad for X amount of times. I've been reading the help and can't figure out how to loop. Please help any help would be appreciated. Thanks

Edited by kforsey

Share this post


Link to post
Share on other sites

Run("NotePad.exe")
WinWait ("Untitled -")

$i = 0

Do
   $i = $i + 1
   Sleep(1000)
   Send("Hello")
   Send("{ENTER}") 

   Sleep(1000)
   Send("Goodbye")
   Send("{ENTER}")
Until $i = 10

where 10 = X (the amount of times u want it to repeat)

=)

Edited by burrup

qq

Share this post


Link to post
Share on other sites

another way =)

Run("NotePad.exe")
WinWait ("Untitled -")

$i = 0

While $i < 10
   $i = $i + 1
   Sleep(1000)
   Send("Hello")
   Send("{ENTER}") 

   Sleep(1000)
   Send("Goodbye")
   Send("{ENTER}")
Wend

qq

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...