Jump to content

Recommended Posts

Posted

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

Posted

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

Posted (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 by igotandrew
  • Developers
Posted

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.
  :)

Posted

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)

NEWHeader1.png

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...