1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| 'ouverture des fichiers
Const ForReading = 1
Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
FichierSource = "c:\Source.txt" 'c'est un exemple
fichierLog = "Parser.log"
Set objTextFile = objFSO.OpenTextFile(Fichiersource, ForReading)
Set objLogFile = objFSO.OpenTextFile (fichierLog, ForAppending, True)
'suppression des doublons
Set objDictionary = CreateObject("Scripting.Dictionary")
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
objDictionary.Add strNextLine, strNextLine
Loop
'stockage des utilisateurs
Set userDictionary = CreateObject("Scripting.Dictionary")
For Each strkey in objDictionary.keys
ArrList = Split(objDictionary.item(strkey),";")
userDictionary.Add ArrList(0),1 'on dira que 1 = consomme..., 0 = consomme pas... et que par défaut il sont à 1
Next
'et maintenant on check s'il consomme uniquement du 1
For Each strkey in objDictionary.keys
ArrList = Split(objDictionary.item(strkey),";")
if ArrList(2) = 0 Then
userDictionary.Remove strkey
userDictionary.Add ArrList(0),0
End If
Next
'on n'a plus qu'à lire l'info
for each strKey in userDictionary
if userDictionary.Item(strkey) = 1 Then
objLogFile.WriteLine strKey
End If
Next
'et on ferme les fichiers
objTextFile.Close
objLogFile.Close |
Partager