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
$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]," ") = 0 Then
$botslots = "N/A"
Else
$botslots = $abotslots[0]
EndIf
If StringCompare($abotque[0]," ") = 0 Then
$botque = "N/A"
Else
$botque = $abotque[0]
EndIf
If StringCompare($abotspeed[0]," ") = 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
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.