Probleme beim Einlesen von Sourcetext

  • Hallo zusammen,

    ich will den Sourcetext einer Webseite einlesen, dabei habe ich verschiedene Schleifen ineinander verschachtelt, bei denen er ggf schon vorher aussteigen soll, falls er einen bestimmten Begriff findet.

    Spoiler anzeigen
    [autoit]

    $file = FileOpen("source.txt",0)
    Global $array[55][12]
    Global $arrayzeile = 0
    $i = 1
    Do
    $networkline = FileReadLine($file,$i)
    If StringInStr($networkline,"Network:") Then
    $anetwork = _StringBetween($networkline,"<B>","</B>")
    $k =$i+1
    Do
    $channelline = Filereadline($file,$k)
    If StringInStr($channelline,"Channel:") Then
    $achannel = _StringBetween($channelline,'">',"</A>")
    $m = $k+1
    Do
    $botline = FileReadLine($file,$m)
    If StringInStr($botline,"<TD noWrap width=115>") Then
    $abotname = _StringBetween($botline,"#000000>","</FONT>")
    $botline = FileReadLine($file,$m+1)
    $abotactive = _StringBetween($botline,"0>","</FONT>")
    $botline = FileReadLine($file,$m+2)
    $abotslots = _StringBetween($botline,"0>","</FONT>")
    $botline = FileReadLine($file,$m+3)
    $abotque = _StringBetween($botline,"3>","</FONT>")
    $botline = FileReadLine($file,$m+4)
    $abotspeed = _StringBetween($botline,"<I>","</I>")
    $botline = FileReadLine($file,$m+5)
    $abotpack = _StringBetween($botline,"toclip('","');")
    $botline = FileReadLine($file,$m+6)
    $abotgets = _StringBetween($botline,"0>","</FONT>")
    $botline = FileReadLine($file,$m+7)
    $abotsize = _StringBetween($botline,"0>","</FONT>")
    $botline = FileReadLine($file,$m+8)
    $abotdescript = _StringBetween($botline,"0>","</FONT>")
    $botname = $abotname[0]
    $botactive = $abotactive[0]
    If StringCompare($abotslots[0],"&nbsp;") = 0 Then
    $botslots = "N/A"
    Else
    $botslots = $abotslots[0]
    EndIf
    If StringCompare($abotque[0],"&nbsp;") = 0 Then
    $botque = "N/A"
    Else
    $botque = $abotque[0]
    EndIf
    If StringCompare($abotspeed[0],"&nbsp;") = 0 Then
    $botspeed = "N/A"
    Else
    $botspeed = $abotspeed[0]&" KB/s"
    EndIf
    $botpack = $abotpack[0]
    $botgets = $abotgets[0]
    $botsize = $abotsize[0]
    $network = $anetwork[0]
    $channel = $achannel[0]
    $botdescript = StringReplace(StringReplace($abotdescript[0],'<B style="COLOR: #003399">',""),"</B>","")
    $arrayzeile += 1
    $array[$arrayzeile][0] = $network
    $array[$arrayzeile][1] = $channel
    $array[$arrayzeile][2] = $botname
    $array[$arrayzeile][3] = $botactive
    $array[$arrayzeile][4] = $botslots
    $array[$arrayzeile][5] = $botque
    $array[$arrayzeile][6] = $botspeed
    $array[$arrayzeile][7] = $botpack
    $array[$arrayzeile][8] = $botgets
    $array[$arrayzeile][9] = $botsize
    $array[$arrayzeile][10] = $botdescript
    _ArrayDisplay($array)
    $m += 8
    EndIf
    $m += 1
    Until StringInStr($botline,"Channel:") Or StringInStr($botline,"Network:")
    EndIf
    $k += 1
    Until StringInStr($channelline,"Network:") = 1
    EndIf
    $i += 1
    Until $i = _FileCountLines("source.txt")-50

    [/autoit]

    Sobald ein Network gefunden ist, soll er nach Channels suchen. Sobald Channel gefunden ist, soll er nach Bots suchen. Sobald Bot gefunden ist, soll er den nächsten Bot suchen, oder aber Network oder Channel und dabei die "Botsuch"-Schleife verlassen.

    Zum Testen hab ich die Source noch angehängt.

    2 Mal editiert, zuletzt von Taek (14. August 2008 um 16:09)

  • Tip schau dir mal die IE funktionen an bzw. die UDF FF funktionen da gibt es doch IEbodyreadtext oder sowas... dann kannste dir den ganzen mist mit stringbetween sparen ;)

    MFG FireFlyer

    *Paradox ist, wenn man sich im Handumdrehen den Fuss bricht* :D

  • Das dacht ich mir auch, aber ich brauch schon den Quelltext, da ich ein paar versteckte Infos brauch. Und ich bin mir auch ziemlich sicher, dass irgendwas an der Schleife nicht stimmt. Mein Array wird ja wunderbar angezeigt, nur eben immer mit dem ersten gefundenen Network.

    EDIT: Habs hinbekommen. Schleifen sind nicht mehr verschachtelt sondern hintereinander (die Variablen werden ja nicht überschrieben...)

    Spoiler anzeigen
    [autoit]

    $file = FileOpen("source.txt",10)
    FileWrite($file,_IEBodyReadHTML($oIE))
    FileClose($file)
    ;_IEQuit($oIE)
    $file = FileOpen("source.txt",0)
    Global $array[55][12]
    Global $arrayzeile = 0
    $i = 100
    Do
    $line = FileReadLine($file,$i)
    If StringInStr($line,"Network:") Then
    $anetwork = _StringBetween($line,"<B>","</B>")
    EndIf
    If StringInStr($line,"Channel:") Then
    $achannel = _StringBetween($line,'">',"</A>")
    EndIf
    If StringInStr($line,"<TD noWrap width=115>") Then
    $abotname = _StringBetween($line,"#000000>","</FONT>")
    $line = FileReadLine($file,$i+1)
    $abotactive = _StringBetween($line,"0>","</FONT>")
    $line = FileReadLine($file,$i+2)
    $abotslots = _StringBetween($line,"0>","</FONT>")
    $line = FileReadLine($file,$i+3)
    $abotque = _StringBetween($line,"3>","</FONT>")
    $line = FileReadLine($file,$i+4)
    $abotspeed = _StringBetween($line,"<I>","</I>")
    $line = FileReadLine($file,$i+5)
    $abotpack = _StringBetween($line,"toclip('","');")
    $line = FileReadLine($file,$i+6)
    $abotgets = _StringBetween($line,"0>","</FONT>")
    $line = FileReadLine($file,$i+7)
    $abotsize = _StringBetween($line,"0>","</FONT>")
    $line = FileReadLine($file,$i+8)
    $abotdescript = _StringBetween($line,"0>","</FONT>")
    $botname = $abotname[0]
    $botactive = $abotactive[0]
    If StringCompare($abotslots[0],"&nbsp;") = 0 Then
    $botslots = "N/A"
    Else
    $botslots = $abotslots[0]
    EndIf
    If StringCompare($abotque[0],"&nbsp;") = 0 Then
    $botque = "N/A"
    Else
    $botque = $abotque[0]
    EndIf
    If StringCompare($abotspeed[0],"&nbsp;") = 0 Then
    $botspeed = "N/A"
    Else
    $botspeed = $abotspeed[0]&" KB/s"
    EndIf
    $botpack = $abotpack[0]
    $botgets = $abotgets[0]
    $botsize = $abotsize[0]
    $network = $anetwork[0]
    $channel = $achannel[0]
    $botdescript = StringReplace(StringReplace($abotdescript[0],'<B style="COLOR: #003399">',""),"</B>","")
    $arrayzeile += 1
    $array[$arrayzeile][0] = $network
    $array[$arrayzeile][1] = $channel
    $array[$arrayzeile][2] = $botname
    $array[$arrayzeile][3] = $botactive
    $array[$arrayzeile][4] = $botslots
    $array[$arrayzeile][5] = $botque
    $array[$arrayzeile][6] = $botspeed
    $array[$arrayzeile][7] = $botpack
    $array[$arrayzeile][8] = $botgets
    $array[$arrayzeile][9] = $botsize
    $array[$arrayzeile][10] = $botdescript
    $i += 8
    EndIf
    $i += 1
    Until $i = _FileCountLines("source.txt")-50
    _ArrayDisplay($array)

    [/autoit]

    Einmal editiert, zuletzt von Taek (14. August 2008 um 16:09)