mahadeva Posted April 1, 2008 Posted April 1, 2008 so what i have here is a code that clicks on the accept link when its avalible and then sleeps for a random amount of time. now i want to improve it a little bit so that when the script clicks on a link, its going to try to click on it again after 5 seconds i have checked around a little bit but i cant find anything that helpes, i would guess there are some "onclick" or "OnAction" that i can start from. anyway here is the code: CODE#include <IE.au3> $oIE = _IECreate ("www.secret;).com") $random = Random(10000, 600000, 1) while 1 _IEAction ($oIE, "refresh") _IELoadWait ($oIE) _IELinkClickByText ($oIE, "accept") sleep ($random) WEnd
covaks Posted April 1, 2008 Posted April 1, 2008 Hi. :-) Me again. What you can do is check the return from _IEClickLinkByText. Helpfile shows that it returns -1 on a succesful click. So.. #include <IE.au3> $oIE = _IECreate ("www.secret;).com") $random = Random(10000, 600000, 1) while 1 _IEAction ($oIE, "refresh") _IELoadWait ($oIE) If _IELinkClickByText ($oIE, "accept") < 0 Then ; Check to see if click was successful sleep(5000) ; Sleep for 5 seconds _IELinkClickByText($oIE, "accept") ; Try to click again. EndIf sleep ($random) WEnd
mahadeva Posted April 1, 2008 Author Posted April 1, 2008 Cool! You are beeing really helpful! Thanks again mate!
mahadeva Posted April 1, 2008 Author Posted April 1, 2008 btw, is it possible to tell the script to start over from the start of the while loop? If _IELinkClickByText ($oIE, "accept") < 0 Then start from the beginning of the while loop ? i have no idea how to do this, on the other hand im gonna give a try to make a function of it, then im pretty sure i can call it from the inside of itself right?
covaks Posted April 1, 2008 Posted April 1, 2008 Hmm. You want to click on the accept link when found, then restart, skipping over the sleep right? Basically you just want to hammer the accept link as fast as you can? Do you still want it to click on the accept link a second time after 5 seconds? Rather than calling a function from within itself, that kind of thing can usually be avoided by just laying out the logic better. You might want to toss the Random() inside the while loop as well, that way it waits a different random amount of time each time through the loop, if you're trying to avoid detection. If you only want it to sleep when it can't find the accept link, you could do this: #include <IE.au3> $oIE = _IECreate ("www.secret;).com") $random = Random(10000, 600000, 1) while 1 _IEAction ($oIE, "refresh") _IELoadWait ($oIE) If _IELinkClickByText ($oIE, "accept") < 0 Then sleep(5000) _IELinkClickByText($oIE, "accept") Else sleep ($random) EndIf WEnd
mahadeva Posted April 1, 2008 Author Posted April 1, 2008 (edited) Perfect... just perfect, you read my mind there Thanks again! Now im off to bed! Edited April 1, 2008 by mahadeva
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now