Jump to content
Sign in to follow this  
Rawox

Loop a script 10 or 20 times?

Recommended Posts

Rawox

I want to make a script that goes to a website, clicks something or anything like that and then goes to the website again and repeats the process...

This is my example code :P... I did not made a real one because I need to know of this is possible.

Is there any short code instead of copying and pasting the same code 10 or 20 times in this document?

And I Know it's a bit long, but it's just an example :(

HotKeySet("{ESC}", "Terminate")

Run("C:\Program Files\Mozilla Firefox\firefox.exe")
WinWaitActive ( "Mozilla Firefox" )
Sleep ( 1000 )

MouseClickDrag ( "left", 700, 55, 250, 55 )
Send ( "{BS}" )
MouseClickDrag ( "left", 700, 55, 250, 55 )
Send ( "{BS}" );Extra Check
MouseClickDrag ( "left", 700, 55, 250, 55 )
Send ( "http://www.google.com/" )
Send ( "{ENTER}" )
WinWaitActive ( "Google" )
MouseClick ( "left", 500, 287 )
Send ( "Testing" )
Send ( "{ENTER}" )
Sleep ( 2000 )

Func Terminate()
    Exit 0
EndFunc

Hope this is possible :idea:

Share this post


Link to post
Share on other sites
Minikori

I want to make a script that goes to a website, clicks something or anything like that and then goes to the website again and repeats the process...

This is my example code :P... I did not made a real one because I need to know of this is possible.

Is there any short code instead of copying and pasting the same code 10 or 20 times in this document?

And I Know it's a bit long, but it's just an example :(

HotKeySet("{ESC}", "Terminate")

Run("C:\Program Files\Mozilla Firefox\firefox.exe")
WinWaitActive ( "Mozilla Firefox" )
Sleep ( 1000 )

MouseClickDrag ( "left", 700, 55, 250, 55 )
Send ( "{BS}" )
MouseClickDrag ( "left", 700, 55, 250, 55 )
Send ( "{BS}" );Extra Check
MouseClickDrag ( "left", 700, 55, 250, 55 )
Send ( "http://www.google.com/" )
Send ( "{ENTER}" )
WinWaitActive ( "Google" )
MouseClick ( "left", 500, 287 )
Send ( "Testing" )
Send ( "{ENTER}" )
Sleep ( 2000 )

Func Terminate()
    Exit 0
EndFunc

Hope this is possible :idea:

For 1 To 20
    ;Your code
Next

Seriously need to look at the help file before asking questions.


For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com

Share this post


Link to post
Share on other sites
Rawox

I did look at the help file but didn't know where to search for, and it's still not working.

I putted away the ESC option, because I got an error with that, but I also get a error: '

For 1 to 3

For ^ Error

now... please help me :P

For 1 To 3

Run("C:\Program Files\Mozilla Firefox\firefox.exe")
WinWaitActive ( "Mozilla Firefox" )
Sleep ( 1000 )

MouseClickDrag ( "left", 700, 55, 250, 55 )
Send ( "{BS}" )
MouseClickDrag ( "left", 700, 55, 250, 55 )
Send ( "{BS}" );Extra Check
MouseClickDrag ( "left", 700, 55, 250, 55 )
Send ( "http://www.google.com/" )
Send ( "{ENTER}" )
WinWaitActive ( "Google" )
MouseClick ( "left", 500, 287 )
Send ( "Testing" )
Send ( "{ENTER}" )
Sleep ( 2000 )


Next

Share this post


Link to post
Share on other sites
Varian

Syntax is incorrect, dude...You need a assign a variable in the For loop

For $i =1 to 3 or For $Count = 1 to 20, etc.

Share this post


Link to post
Share on other sites
Rawox

I'm totally new to this, could someone please try it, I can't get it to work :P

HotKeySet("{ESC}", "Terminate")

Run("C:\Program Files\Mozilla Firefox\firefox.exe")
WinWaitActive ( "Mozilla Firefox" )
Sleep ( 1000 )

MouseClickDrag ( "left", 700, 55, 250, 55 )
Send ( "{BS}" )
MouseClickDrag ( "left", 700, 55, 250, 55 )
Send ( "{BS}" );Extra Check
MouseClickDrag ( "left", 700, 55, 250, 55 )
Send ( "http://www.google.com/" )
Send ( "{ENTER}" )
WinWaitActive ( "Google" )
MouseClick ( "left", 500, 287 )
Send ( "Testing" )
Send ( "{ENTER}" )
Sleep ( 2000 )

Func Terminate()
    Exit 0
EndFunc
Edited by Rawox

Share this post


Link to post
Share on other sites
Minikori

I'm totally new to this, could someone please try it, I can't get it to work :P

HotKeySet("{ESC}", "Terminate")

Run("C:\Program Files\Mozilla Firefox\firefox.exe")
WinWaitActive ( "Mozilla Firefox" )
Sleep ( 1000 )

MouseClickDrag ( "left", 700, 55, 250, 55 )
Send ( "{BS}" )
MouseClickDrag ( "left", 700, 55, 250, 55 )
Send ( "{BS}" );Extra Check
MouseClickDrag ( "left", 700, 55, 250, 55 )
Send ( "http://www.google.com/" )
Send ( "{ENTER}" )
WinWaitActive ( "Google" )
MouseClick ( "left", 500, 287 )
Send ( "Testing" )
Send ( "{ENTER}" )
Sleep ( 2000 )

Func Terminate()
    Exit 0
EndFunc
HotKeySet("{ESC}", "Terminate")

Run("C:\Program Files\Mozilla Firefox\firefox.exe")
WinWaitActive ( "Mozilla Firefox" )
Sleep ( 1000 )

For $x = 1 To 20;Assuming this is what you want to loop 20 times
    MouseClickDrag ( "left", 700, 55, 250, 55 )
    Send ( "{BS}" )
    MouseClickDrag ( "left", 700, 55, 250, 55 )
    Send ( "{BS}" );Extra Check
    MouseClickDrag ( "left", 700, 55, 250, 55 )
    Send ( "http://www.google.com/" )
    Send ( "{ENTER}" )
    WinWaitActive ( "Google" )
    MouseClick ( "left", 500, 287 )
    Send ( "Testing" )
    Send ( "{ENTER}" )
    Sleep ( 2000 )
Next

Func Terminate()
    Exit 0
EndFunc

For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com

Share this post


Link to post
Share on other sites
UnknownWarrior

I have a similar question to this as well... Would this work if its in a While Loop? If I have say:

While 1

Sleep(5000)
Send['{F9}']
Sleep(100)
Click() ;--- just a func of mine

WEnd

Instead of copying and pasting this 10 times (which is how many times I need it done) could i do this instead:

While 1

For $x = 1 To 10
Sleep(5000)
Send['{F9}']
Sleep(100)
Click() ;--- just a func of mine

Next

WEnd

Share this post


Link to post
Share on other sites
Minikori

I have a similar question to this as well... Would this work if its in a While Loop? If I have say:

While 1

Sleep(5000)
Send['{F9}']
Sleep(100)
Click();--- just a func of mine

WEnd

Instead of copying and pasting this 10 times (which is how many times I need it done) could i do this instead:

While 1

For $x = 1 To 10
Sleep(5000)
Send['{F9}']
Sleep(100)
Click();--- just a func of mine

Next

WEnd
Yes that would work.

For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com

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  

×