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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| FichierEcommerce = "1-EcommerceMini.txt"
FichierTarif = "1-TarifMini.txt"
JusteEcom = "JusteEcom.txt"
TarifSansEcom = "TarifSansEcom.txt"
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Ouverture fichier Ecommerce en lecture
Set objFSO_ECommerce = objFSO.OpenTextFile (FichierEcommerce, ForReading, false)
'Ouverture fichier Tarifs en lecture
Set objFSO_Tarif = objFSO.OpenTextFile (FichierTarif, ForReading, false)
'lecture de chaque ligne
Do While objFSO_ECommerce.AtEndOfStream=false
'pour chaque ligne du fichier Ecommerce
LigneEcommerce = objFSO_ECommerce.ReadLine
'on cherche la reference colonne 90 et on recupere les 16 caracteres suivant
Ref_ECommerce = Mid(LigneEcommerce, 90, 16)
'suppression des espaces
Ref_ECommerce = LTrim(Ref_ECommerce)
'wscript.echo Ref_ECommerce
wscript.echo "ref ecommerce " & Ref_ECommerce
'Ouverture fichier Tarifs en lecture
Set objFSO_Tarif = objFSO.OpenTextFile (FichierTarif, ForReading, false)
'wscript.echo "1 : " & countTarif
Do While objFSO_Tarif.AtEndOfStream=false
'wscript.echo objFSO_Tarif.ReadLine
'pour chaque ligne du fichier Tarif
'on cherche la reference colonne 90 et on recupere les 16 caracteres suivant
LigneTarif = ""
LigneTarif = objFSO_Tarif.ReadLine
Ref_Tarif = Mid(LigneTarif, 90, 16)
'suppression des espaces
Ref_Tarif = LTrim(Ref_Tarif)
'Si Ref_Tarif = Ref_Tarif --> on ecrit pa ligne dans un nouveau fichier tarif
'compare les 2 ref --> si egale = 0 alors les 2 ref sont identiques
'Test les 2 ref
egale = StrComp(Ref_Tarif, Ref_ECommerce, 1)
'Si Les 2 ref sont les memes
If (egale=0) Then
'wscript.echo "test oui Ref Tarif : " & Ref_Tarif & " Ref Ecommercer : " & Ref_ECommerce
'On ecrit la ligne dans le fichier Dif
Set objFSO_Dif = objFSO.OpenTextFile(JusteEcom,ForAppending,true)
objFSO_Dif.Writeline(LigneTarif)
objFSO_Dif.close
'sinon
Else
'Si non, on ecrit la ligne dans le NewFichierTarif
Set objFSO_New = objFSO.OpenTextFile(TarifSansEcom,ForAppending,true)
objFSO_New.WriteLine(LigneTarif)
objFSO_New.close
End if
Loop
objFSO_Tarif.close
Loop
objFSO_ECommerce.close |
Partager