| 12
 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
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 
 | Dim Centre
Dim Plaque
Dim Source
Dim Destination
DIM Log
Dim objFSO, objFolder, FileLog,fso,fileflag,fileBak
 
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objArgs = Wscript.Arguments 
 
VERSION="1.00"
 
centre = objArgs(0) 
 
Select Case Centre
Case "PARIS"
	Plaque="NORD"
Case "MARSEILLE"
	Plaque="SUD"
Case "LILLE"
	Plaque="NORD"
Case "TOULOUSE"
	Plaque="SUD"
Case "LYON"
	Plaque="CENTRE"
Case Else
	Wscript.echo "Erreur dans le parametre"
	wscript.quit(2)
End Select
 
 
Log="C:\Appli\Log\Historique\Historique_" & centre & ".log"
 
Set fso = Wscript.CreateObject("Scripting.FileSystemObject")
Set FileLog = FSO.CreateTextFile(Log)
 
MyDate = Day(Now) & "." & Year(Now) & "." & Month(Now)   
FILE_SUPP="C:\Appli\Common\archivage\" & Centre & "\etats\*.pdf"
Source = "C:\Appli\Common\archivage\" & Centre & "\etats"
Destination = "S:\Historique\etats\Liste_Etats_"& Centre &" "& MyDate &".zip"
 
Sub Msglog(severite,code,label)
	wscript.echo Mydate & "-" & time & " " & severite & " " & code & " " & label
	FileLog.WriteLine(Mydate & "-" & time & " " & severite & " " & code & " " & label) 
end sub
 
'Debut du traitement
 
For Each Centre In Split(Centre,";",-1)
 
 
MyHex = _
Array(80, 75, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
 
For i = 0 To UBound(MyHex)
    MyBinary = MyBinary & Chr(MyHex(i))
 
	Next
 
Set oShell = CreateObject("WScript.Shell")
Set oFileSys = CreateObject("Scripting.FileSystemObject")
 
'Creation du zip
msglog "0","0000","-Debut: Traitement du ZIP " & Source & " et déplacement dans " & Destination & " pour le centre " & centre
set oCTF = oFileSys.CreateTextFile(Destination, True)
oCTF.Write MyBinary
oCTF.Close
Set oCTF = Nothing
 
Set oApp = CreateObject("Shell.Application")
Set oFolder = oApp.NameSpace(Source)
If Not oFolder Is Nothing Then _
    oApp.NameSpace(Destination).CopyHere oFolder.Items
 
wScript.Sleep 3600000
 
Set oFile = Nothing
 
msglog "0","0000","-Fin: Traitement du ZIP " & Source & " et déplacement dans " & Destination & " pour le centre " & centre
 
 
 
Next
 
Sub SupprimeFiles
	Dim objsupp
	Set objsupp = WScript.CreateObject("Scripting.FileSystemObject")
	msglog "0","0000","-Debut: Suppresion des fichiers " & FILE_SUPP & " pour le centre " & centre
		objsupp.deletefile FILE_SUPP , force
	msglog "0","0000","-Fin: Suppresion des fichiers " & FILE_SUPP & " pour le centre " & centre	
end sub
 
msglog "0","0000","---Debut: Historique.vbs "
SupprimeFiles
msglog "0","0000","---Fin: Historique.vbs"
FileLog.Close | 
Partager