Je voudrais cibler des caractères bien précis dans un fichier texte. Il s'agit d'adresse IP. J'ai fait fonction qui marche moyen, si une adresse IP est différente de "127.0.0.1 localhost" alors on écrit qu'il est redirigé mais cela m'affiche un résultat comme quoi il est redirigé ( le fichier Hosts ) alors qu'il ne l'ai pas !
Code:
Code : Tout sélectionner
#Include <File.au3>
#Include <Array.au3>
Local $tableau[1], _
$hosts = @WindowsDir & "\system32\drivers\etc\hosts", _
$lignes = '127.0.0.1 localhost' & '|' & " Copyright (c) 1993-1999 Microsoft Corp."
Local $rap
$rap = FileOpen ('C:\test.txt',1)
_FileReadToArray($hosts,$tableau)
For $i In $Tableau
if StringRegExp($i, "#| C") then ContinueLoop
if not StringInStr("|" & $lignes & "|", "|" & $i & "|") then
if @error then ExitLoop
FileWriteLine($rap, "Fichier Hosts redirigé !" & $i)
Else
FileWriteLine($rap, "Fichier Hosts propre !")
endif
Next
FileClose($rap)Merci,
JW




