Code:
#include <array.au3>
#include <File.au3>
_start()
func _start()
Local $sSuchstring = "<HosterName>Rapidgator.net</HosterName>"
Local $aIndex[0]
local $sFilePath, $aArray
Local $message = "Bitte wählen Sie die Import Datei aus!"
Local $sFilePath = FileOpenDialog($message, @ScriptDir & "\", "xml (*.xml)", 1 + 4)
If @error Then
MsgBox(4096, "", "Keine Datei(en) ausgewählt")
Exit
Else
$sFilePath = StringReplace($sFilePath, "|", @CRLF)
_FileReadToArray($sFilePath, $aArray)
_ArrayDelete($aArray, 0)
EndIf
For $i = 0 to UBound($aArray)-1
if StringInStr($aArray[$i],$sSuchstring) Then
_ArrayAdd($aIndex,$i-1)
_ArrayAdd($aIndex,$i-2)
_ArrayAdd($aIndex,$i-3)
_ArrayAdd($aIndex,$i)
_ArrayAdd($aIndex,$i+1)
_ArrayAdd($aIndex,$i+2)
_ArrayAdd($aIndex,$i+3)
EndIf
Next
$sFilePath = StringReplace($sFilePath,".xml","_new.xml")
Local $hFileOpen = FileOpen($sFilePath, 2+8)
If $hFileOpen = -1 Then
MsgBox($MB_SYSTEMMODAL, "", "Es ist während dem lesen der Datei ein Fehler aufgetreten.")
Return False
EndIf
For $ii = 0 to UBound($aArray)-1
For $iii = 0 to UBound($aIndex)-1
If $ii = $aIndex[$iii] Then
$aArray[$ii]=""
Else
EndIf
Next
Next
For $i = 0 to UBound($aArray)-1
if $aArray[$i]="" Then
Else
FileWrite($hFileOpen,$aArray[$i]&@CRLF)
EndIf
Next
FileClose($hFileOpen)
MsgBox(64,"Fertig",$sFilePath)
EndFunc