igotandrew Posted December 24, 2008 Posted December 24, 2008 Or something like it? In vb6/vbs you could've easily done Function XX(Params as variables) while if conditional statement = true then goto cd end if wend cd: end function
clarinetmeister Posted December 24, 2008 Posted December 24, 2008 http://www.autoitscript.com/autoit3/docs/faq.htm
igotandrew Posted December 24, 2008 Author Posted December 24, 2008 Then any thoughts on how I'd go up on this? I'm working on a spider / web crawler So While 1 (makes it go on forever) If page src contains (compare to list of words via text file) then exit loop, go to new web page Otherwise do stuff Wend
Developers Jos Posted December 24, 2008 Developers Posted December 24, 2008 In you earlier posted example an ExitLoop would do the job. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
igotandrew Posted December 24, 2008 Author Posted December 24, 2008 I don't want to stop the web crawling permanently, I just want it to move on.
Developers Jos Posted December 24, 2008 Developers Posted December 24, 2008 I just commented on your initial posted code. You will have to post some code for me to be able to help out. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
igotandrew Posted December 24, 2008 Author Posted December 24, 2008 (edited) Func P() While 1 _IENavigate($oIE, "webpage" & $vID) $oSrc = _IEBodyReadText($oIE) For $i = 1 to $B[0] If StringInStr($oSrc, $B[$i], 2) > 0 Then;something detected L("Encountered blacklisted site '" & $B[$i] & "', skipping. URL: " & $vID) EndIf Next ; do junk $vID = $vID + 2 WEnd EndFunc And $B is an array holding websites (it's entries are irrelevant, and are from a text file (split)) It should exit where it says "encountered black listed site" I'm thinking of moving the $vID = $vID +2 to the front, I'm not really 100% sure what to do. Edited December 24, 2008 by igotandrew
Developers Jos Posted December 24, 2008 Developers Posted December 24, 2008 To exit the for-next loop when the IF is true you just add the ExitLoop after line containing the L(...). This will stop the for next loop but will stay within the While-Wend loop Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
igotandrew Posted December 24, 2008 Author Posted December 24, 2008 Is there a way to bypass the "do stuff" if something is detected in the for loop?
igotandrew Posted December 24, 2008 Author Posted December 24, 2008 I'm an idiot. After thinking about this logicailly for a few minutes, I came to the answer. Thanks.
Valuater Posted December 24, 2008 Posted December 24, 2008 There are many, many was to handle that Func P() Local $pass While 1 $pass = "" _IENavigate($oIE, "webpage" & $vID) $oSrc = _IEBodyReadText($oIE) For $i = 1 To $B[0] If StringInStr($oSrc, $B[$i], 2) > 0 Then;something detected ;L("Encountered blacklisted site '" & $B[$i] & "', skipping. URL: " & $vID) $pass = 1 EndIf Next If $pass = "" Then ; do junk EndIf $vID = $vID + 2 WEnd EndFunc ;==>P 8)
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