Bonsoir, je voudrais savoir s'il était possible avec un tableau et cette fonction de récupérer les données d'un tableau.
la fonction doublon:
et le tableau:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Function Doublon () Const ForReading = 1 Const ForWriting = 2 Set objDictionary = CreateObject("Scripting.Dictionary") Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile _ ("C:\...\login.txt", ForReading) Do Until objFile.AtEndOfStream strName = objFile.ReadLine If Not objDictionary.Exists(strName) Then objDictionary.Add strName, strName End If Loop objFile.Close Set objFile = objFSO.OpenTextFile _ ("C:\...\login.txt", ForWriting) For Each strKey in objDictionary.Keys objFile.WriteLine strKey Next objFile.Close
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 Do While ligne <> "" TAB = Split (ligne, ";") Prenom = TAB(0) Nom = TAB(1) Login = TAB(2) Pass = TAB(3) If UBound (TAB) = 4 Then Suppr = "S"
Avec au final avoir la possibilité d'utiliser les tab pour vérifier dans les lignes du fichier créer (autres fonctions du script, mais la n'est pas la question..) si le login est le meme, le prenom et le nom aussi.
en gros faire un fichier.Readline puis
if tab(0) = tab(0) & TAB(1) = TAB(1) OR TAB(2) = TAB(2)
fichier.writeline (avant le 3e ; qui indique le login, je pense que c'est un step -1 qu'il faudrait utiliser..) mettre un add "1" (pour combler le doublon du login)
ce qui donnera pour le programme a faire. Si dans le fichier:
jmmartin
jmmartin
doublon !
jmmartin
>jmmartin1
Partager