Bonjour tout le monde
et Bonjour Cachlab

J'aurais encore besoin ton votre aide pour mon scripte de sauvegarde

Je voudrais affichier une fenetre d'une barre de progression ou quelque chose qui tourne en indiquant que c'est en cours de sauvegarde, quand je clique sur sauvegarde.

J'ai trouvé un code de barre progression sur internet :

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
<hta:application
	maximizebutton="no"
	contextmenu="no"
	selection="no"
	showintaskbar="no"
	scroll="no"
>
<title>Data Transfer</title>
<body bgcolor="silver" onLoad="resizeTo(900,90);moveTo(200,450)">
<script>
var c=0;
window.setInterval('if(c<=800){document.getElementById("loadbar").style.width=c;document.getElementById("p100").innerHTML=Math.round(c/8)+"%";c++}else{alert("Data Transfer Finished");window.close()}',3);
</script>
<div style="background-color:gray;width:800;border:inset thin"><div id="loadbar" style="background-color:green;border:outset thin">&nbsp;</div></div>
<center><font face="Microsoft sans serif"><div id="p100"></div></font></center>
Je voudrais intégrer une ligne de code dans mon scripte

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
var c=0;
window.setInterval('if(c<=800){document.getElementById("loadbar").style.width=c;document.getElementById("p100").innerHTML=Math.round(c/8)+"%";c++}else{alert("Data Transfer Finished");window.close()}',3);

Voici mon appli HTA

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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
 
<HTML><HEAD>
    <TITLE></TITLE>
    <HTA:APPLICATION
    APPLICATIONNAME="Sauvegarde Favoris"
    BORDER="THIN"
    BORDERSTYLE="NORMAL"
    ICON="Explorer.exe"
    INNERBORDER="NO"
    MAXIMIZEBUTTON="NO"
    MINIMIZEBUTTON="NO"
    SCROLL="NO"
    SELECTION="NO"
    SINGLEINSTANCE="YES"/></HEAD>
    <META HTTP-EQUIV="MSThemeCompatible" CONTENT="YES">
    <BODY TOPMARGIN="1" LEFTMARGIN="1"><CENTER><DIV><SPAN ID="ONSCR"></SPAN></DIV></CENTER></BODY>
 
	<SCRIPT LANGUAGE="VBScript">
	call MenuPrincipal
 
	SUB InnerWindowSize(intWidth,intHeight)
    Self.ResizeTo intWidth,intHeight
    Self.ResizeTo intWidth+(intWidth-Document.Body.OffsetWidth),intHeight+(intHeight-Document.Body.OffsetHeight)
    Self.MoveTo (Screen.Width/2)-(intWidth/2),(Screen.Height/2)-(intHeight/2)
    END SUB
 
	Sub CenterWindow(x,y)
    window.resizeTo x, y
    iLeft = window.screen.availWidth/2 - x/2
    itop = window.screen.availHeight/2 - y/2
    window.moveTo ileft, itop
    End Sub
 
    SUB MenuPrincipal()
    Self.document.title = "Sauvegarde Favoris"
    CALL InnerWindowSize(675,400)
    ONSCR.InnerHTML="<table align=""center"" border=""1"" BGCOLOR=""#BBBFFF"" BORDERCOLOR=""#000000"">"_
	&"<tr><td><img src=""banniere.png""></td></tr></table>"_
    &"<TABLE WIDTH=""675"" HEIGHT=""278"" BORDER=""1"" BGCOLOR=""#BBBFFF"" BORDERCOLOR=""#000000"" CELLPADDING=""0"" CELLSPACING=""1"">"_
    &"<P><TR><TD><CENTER>"_
	&"<DIV ALIGN=""center"" STYLE=""font:12 pt arial; color:black"">"_
    &"Cliquer sur le bouton <B>""Sauvegarder Favoris""</B> pour lancer la sauvegarde des favoris de vos navigateurs Internet."_
	&"<BR>"_
	&"<BR><INPUT TYPE=""BUTTON"" STYLE=""HEIGHT:25;WIDTH:165"" VALUE=""Sauvegarder Favoris"" LANGUAGE=""VBScript"" ONCLICK=""SauvIE()""><P>"_
	&"Cliquer sur le bouton <B>""Recuperer Favoris""</B> pour lancer la recuperation des favoris (sauvegarde prealable requise)."_
	&"<BR>"_
	&"<BR><INPUT TYPE=""BUTTON"" STYLE=""HEIGHT:25;WIDTH:165"" VALUE=""Recuperer Favoris"" LANGUAGE=""VBScript"" ONCLICK=""recpIE()""><P>"_
	&"</DIV>"_
    &"</TD></CENTER></TR></TABLE>"
	END SUB
 
Sub SauvIE
 
call barprog
 
	Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")
	Dim objShell : Set objShell = CreateObject("WScript.Shell")
	Dim objWMIService, objFolder, LectSauv, sUserProfile, sUserAppData, strComputer
	Dim SauvRep(2), DestRep(2)
  MsgBox "Attention pour le bon fonctionnement du script veuillez vous assurer que toutes les fenêtres navigateur internet soient fermées ",vbInformation,"Information"
' Destination de la sauvegarde
LectSauv = "P:"
RepSauv = LectSauv & "\Sauvegarde_Favoris"
'Test du lecteur réseau (ici P:) et arrêt du script si inexistant
If Not objFSO.DriveExists(LectSauv) Then MsgBox "Vous ne disposez pas de répertoire personnel, Veuillez contacter votre service Securité logique", vbInformation, "Information" : call MenuPrincipal : Exit Sub
'Test du répertoire principal de sauvegarde et création si besoin (ici P:\Sauvegarde)
If Not objFSO.FolderExists(RepSauv) Then objFolder = objFSO.CreateFolder(RepSauv)
 
'Recherche et kill des process IE et Firefox
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 
Set colProcessList = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = 'firefox.exe'")
For Each objProcess in colProcessList
ObjProcess.Terminate()
Next
 
'Définition des répertoires locaux (nom court) à rechercher
SauvRep(0) = "\Favoris"
SauvRep(1) = "\Favoris"
SauvRep(2) = "\Profiles"
 
'Création des noms des répertoires de sauvegarde (ex. P:\Sauvegarde\Favoris)
For i = 0 to 2
DestRep(i) = RepSauv & SauvRep(i)
Next
 
'Redéfinition des répertoires locaux (nom complets) à rechercher
sUserProfile = objShell.ExpandEnvironmentStrings("%USERPROFILE%")
sUserAppData = objShell.ExpandEnvironmentStrings("%APPDATA%")
 
SauvRep(0) = sUserProfile & SauvRep(0)
SauvRep(1) = sUserProfile & "\Favorites"
SauvRep(2) = sUserAppData & "\Mozilla\Firefox" & SauvRep(2)
 
'Boucle de traitement
For i = 0 to 2
if objFSO.FolderExists(SauvRep(i)) Then 'Si le répertoire local existe
	if Not objFSO.FolderExists(DestRep(i)) Then objFolder = objFSO.CreateFolder(DestRep(i)) 'Si le répertoire destination n'existe pas, on le crée
	objFSO.CopyFolder SauvRep(i) , DestRep(i), True ' et on lance la copie
end if
Next
 
call MenuPrincipal
 
End Sub
 
Sub recpIE
call barprog
	Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")
	Dim objShell : Set objShell = CreateObject("WScript.Shell")
	Dim objWMIService, objFolder, LectSauv, sUserProfile, sUserAppData, strComputer
	Dim SauvRep(2), DestRep(2)
 MsgBox "Attention pour le bon fonctionnement du script veuillez vous assurer que toutes les fenêtres navigateur internet soient fermées ",vbInformation,"Information"
' Destination de la sauvegarde
LectSauv = "P:"
RepSauv = LectSauv & "\Sauvegarde_Favoris"
 
'Test du lecteur réseau (ici P:) et arrêt du script si inexistant
If Not objFSO.DriveExists(LectSauv) Then MsgBox "Vous ne disposez pas de répertoire personnel, Veuillez contacter votre service Securité logique", vbInformation, "Information" : call MenuPrincipal : Exit Sub
'Test du répertoire principal de sauvegarde et création si besoin (ici P:\Sauvegarde)
If Not objFSO.FolderExists(RepSauv) Then objFolder = objFSO.CreateFolder(RepSauv)
 
'Recherche et kill des process IE et Firefox
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 
Set colProcessList = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = 'firefox.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
 
'Définition des répertoires locaux (nom court) à rechercher
SauvRep(0) = "\Favoris"
SauvRep(1) = "\Favoris"
SauvRep(2) = "\Profiles"
 
'Création des noms des répertoires de sauvegarde (ex. P:\Sauvegarde\Favoris)
For i = 0 to 2
DestRep(i) = RepSauv & SauvRep(i)
Next
 
'Redéfinition des répertoires locaux (nom complets) à rechercher
sUserProfile = objShell.ExpandEnvironmentStrings("%USERPROFILE%")
sUserAppData = objShell.ExpandEnvironmentStrings("%APPDATA%")
 
SauvRep(0) = sUserProfile & SauvRep(0)
SauvRep(1) = sUserProfile & "\Favorites"
SauvRep(2) = sUserAppData & "\Mozilla\Firefox" & SauvRep(2)
 
'Boucle de traitement
For i = 0 to 2
if objFSO.FolderExists(SauvRep(i)) Then 'Si le répertoire local existe
	if Not objFSO.FolderExists(DestRep(i)) Then objFolder = objFSO.CreateFolder(DestRep(i)) 'Si le répertoire destination n'existe pas, on le crée
	objFSO.CopyFolder DestRep(i) , SauvRep(i), True ' et on lance la copie
end if
Next
call MenuPrincipal
End Sub
 
    SUB barprog()
    Self.document.title = "Sauvegarde Favoris"
    CALL InnerWindowSize(802,90)
	ONSCR.InnerHTML="<br><div style=""bgcolor:silver;width:800;border:inset thin""><div id=""loadbar"" style=""background-color:green;border:outset thin"">&nbsp;</div></div>"_
	&"<center><font face=""Microsoft sans serif""><div id=""p100""></div></font></center>"_
	End Sub
 
</SCRIPT>
Je vous remercie d'avance !!!