Bonjour,

BBil a été extrement patient et serviable qu'il m'a écrit un script que j'ai absolument besoin. Hors app il est en VB et j'en aurais besoin en VBscript.
Et c'est ici que je dois être allors

Pourriez-vous m'aider à le transformer ?
BAV tous ,

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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
 
Option Explicit
Sub ConvertiFichier()
Dim f As Integer
Dim stRep As String
Dim stFichierSource As String
Dim stFichierDest As String
Dim stLigne1 As String
Dim stLigne2 As String
Dim st As String
Dim tbLg
Dim tb
Dim i As Integer
stRep = "c:\tmp\" 'Répertoire de travail
 
stFichierSource = "avant_test_144503.log.txt"
stFichierDest = "apres.txt"
f = FreeFile
Open stRep & stFichierSource For Input As #f 'Ouverture fichier source
While Not EOF(f)
  Line Input #f, st 'Lecture d'une ligne
  'Finalement .. ligne input lit tous le fichier car les lignes
  'ne comporte que le carcatére 10 en fin (pas de retour chariot 13..)
  ' découpage de la chaine en lignes...
  tbLg = Split(st, Chr(10))
  For i = 0 To UBound(tbLg) 'parcours les lignes
    tb = Split(tbLg(i), Chr(&H1C))
    If (UBound(tb) >= 2) Then
        stLigne1 = stLigne1 & tb(0) & vbTab
        stLigne2 = stLigne2 & tb(2) & vbTab
    End If
  Next i
 
Wend
Close #f
f = FreeFile
'Ouverture fichier destination en ecriture le fichier existant sera écrasé..
Open stRep & stFichierDest For Output As #f
 Print #f, stLigne1
 Print #f, stLigne2
 
Close #f
 
End Sub