This repository has been archived by the owner on Sep 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileWalker.hta
437 lines (416 loc) · 11.9 KB
/
FileWalker.hta
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
<html>
<head><title>Explorateur de dossier</title>
<hta:application
ApplicationName="Explorer"
Border="none"
caption="no"
contextmenu="no"
scroll="no"
selection="no"
SysMenu="no"
singleinstance="yes"
showintaskBar="yes">
<style type=text/css>
body {font-family: Verdana; background-color: black; border-style: none
scrollbar-face-color:black;
scrollbar-highlight-color:black;
scrollbar-3dlight-color:black;
scrollbar-darkshadow-color:white;
scrollbar-shadow-color:deepskyblue;
scrollbar-arrow-color:black;
scrollbar-track-color:black;}
#fond {position: absolute; z-index: 0; filter: Alpha(opacity=30)}
#dossierActuel {position: absolute; top: 10; left: 10; border-style: none}
h3.titre {font-size: 14; font-weight: bold; color: white}
a {font-size: 12; font-weight: normal; cursor: default; text-decoration: none}
a:hover {color: white; background-color: black; text-decoration: underline overline}
a.lecteur {color: magenta}
a.dossier {color: deepskyblue}
a.fichier {color: red}
a.plus {color: white; font-family: monospace}
a.plus:hover {text-decoration: none; background-color: transparent}
#titreDossier {position: absolute; left: 10pt; top: 30pt; width: 250pt}
#titreContenu {position: absolute; left: 270pt; top: 30pt}
#divDossier {position: absolute; left: 10pt; top: 50pt; width: 250pt; overflow: auto}
#divContenu {position: absolute; right: 0pt; top: 50pt; overflow: auto}
#chemin {position: absolute; width: 20pt; height: 20pt; overflow: hidden; visibility: hidden; color: white}
#controleFenetre {position: absolute; right: 0pt; top: 0pt}
#controleFenetre table td {border-style: none; text-align: center}
div.carre {background-color: deepskyblue; width: 12pt; height: 12pt; font: 12 'Arial Unicode MS'; filter: Alpha(opacity=70)}
#boutonFermer {background-color: red}
#filtre {position: absolute; background-color: buttonface; visibility: hidden}
</style>
<script language=jscript>
function ObjetParId(nom) {
return window[nom];
}
function ObjetExistant(id) {
return window[id]?true:false;
}
</script>
<script language=vbscript>
Set Fso = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
w = (window.screen.width * 3) \ 4
h = (window.screen.height * 3) \ 4
x = (window.screen.width - w) \ 2
y = (window.screen.width - w) \ 2
bgpath = WshShell.RegRead("HKCU\Control Panel\Desktop\Wallpaper")
Function CompterOccurence(str,occ)
dim str2, i
str2 = str
i = 0
Do Until InStr(str2,occ) = 0
str2 = Replace(str2,occ,"",1,1)
i = i + 1
Loop
CompterOccurence = i
End Function
Sub Enregistrer(id,path)
dim id2
id2 = id & "c"
If not ObjetExistant(id2) Then
window.chemin.insertAdjacentHTML "BeforeEnd", "<a id=" & id2 & ">" & path & "</a>"
Else
If ObjetParId(id2).innerText <> path Then
ObjetParId(id2).innerText = path
End If
End If
End Sub
Sub Explorer(id)
If not ObjetExistant(id) Then
Developper Left(id,InStrRev(id,"_")-1)
End If
Developper id
AfficherContenu id
End Sub
Sub Executer(id)
On Error Resume Next
WshShell.Run ObjetParId(id & "c").innerText
If Err.Number <> 0 Then
alert "Impossible d'ouvrir le fichier " & ObjetParId(id).innerText & "."
End If
End Sub
Function Normaliser(str)
dim str2
str2 = Replace(str,"/","\")
If InStrRev(str2,"\") <> Len(str2) Then
str2 = str2 & "\"
End If
Normaliser = str2
End Function
Sub ExaminerPlus(id)
dim signe
signe = Mid(ObjetParId(id).innerText,2,1)
If signe = "+" Then
Developper id
Else
Reduire id
End If
End Sub
Function LireAttrib(attr,attrStr)
dim Tableau, Chaine, Prov, Puiss
Tableau = Array("ReadOnly","Hidden","System","Volume","Directory","Archive","Alias","Compressed")
Chaine = ""
If attr = 0 Then
Chaine = "Normal"
Else
Prov = attr
Puiss = 7
Do Until Prov = 0
If Prov >= (2^Puiss) Then
Chaine = Chaine & Tableau(Puiss)
If Prov = (2^Puiss) Then
Exit Do
Else
Prov = Prov - (2^Puiss)
End If
End If
Puiss = Puiss - 1
Loop
End If
LireAttrib = InStr(Chaine,attrStr) <> 0
End Function
Function Visible(f)
v = true
t = Array("Archive","Hidden","ReadOnly","System")
For i = 0 to 3
If not ObjetParId(t(i)).checked and LireAttrib(f.Attributes,t(i)) then
v = false
Exit For
End If
Next
Visible = v
End Function
Sub ListerLecteurs
dim dc, i, id1, id2, id3, fonction1, fonction2, n
Set dc = Fso.Drives
window.dossiers.innerHTML = ""
i = 0
For Each d in dc
i = i + 1
id1 = "d" & i
id2 = id1 + "d"
id3 = id1 + "f"
fonction1 = "ExaminerPlus(" & chr(39) & id1 & chr(39) & ")"
fonction2 = "Explorer(" & chr(39) & id1 & chr(39) & ")"
n = "<div><a href=# class=plus id=" & id1 & " onClick=" & fonction1 & ">[+] </a>"
n = n & "<a href=# class=lecteur id=" & id2 & " onClick=" & fonction2 & ">"
If d.DriveType = 3 Then
n = n & d.ShareName
ElseIf d.IsReady Then
n = n & d.VolumeName
Else
Select Case d.DriveType
Case 0
n = n & "Lecteur inconnu"
Case 1
n = n & "Amovible"
Case 4
n = n & "Disque CD-ROM"
Case 5
n = n & "RAMDisk"
End Select
End If
n = n & " (" & d.DriveLetter & ":)</a>"
n = n & "<font id=" & id3 & "></font></div>"
window.dossiers.insertAdjacentHTML "BeforeEnd", n
Enregistrer id1, d.Path
Next
End Sub
Sub AfficherContenu(id)
window.document.body.style.cursor = "wait"
On Error Resume Next
dim path, fld, fldc, sfld, i, id1, id2, id0, fonction, n, fc, f
window.contenus.innerHTML = ""
path = ObjetParId(id & "c").innerText
window.dossierActuel.value = path
Set fld = fso.GetFolder(Normaliser(path))
Set fldc = fld.SubFolders
i = 0
For Each sfld in fldc
i = i + 1
id1 = id & "_" & i
id2 = id1 & "e"
id0 = id1 & "i"
fonction = "Explorer(" & chr(39) & id1 & chr(39) & ")"
n = "<div id=" & id0 & "><nobr><a href=# class=dossier id=" & id2 & " onClick=" & fonction & ">" & sfld.Name & "</a></nobr></div>"
window.contenus.insertAdjacentHTML "BeforeEnd", n
Enregistrer id1, sfld.Path
bulle = "Créé le " & sfld.DateCreated & chr(13)
bulle = bulle & "Modifié le " & sfld.DateLastModified & chr(13)
bulle = bulle & "Dernier accès le " & sfld.DateLastAccessed
ObjetParId(id0).title = bulle
Next
Set fc = fld.Files
i = 0
For Each f in fc
i = i + 1
id1 = "f" & i
id0 = id1 & "i"
fonction = "Executer(" & chr(39) & id1 & chr(39) & ")"
n = "<div id=" & id0 & "><nobr><a href=# class=fichier id=" & id1 & " onClick=" & fonction & ">" & f.Name & "</a></nobr></div>"
window.contenus.insertAdjacentHTML "BeforeEnd", n
Enregistrer id1, f.ShortPath
bulle = "Créé le " & f.DateCreated & chr(13)
bulle = bulle & "Modifié le " & f.DateLastModified & chr(13)
bulle = bulle & "Dernier accès le " & f.DateLastAccessed
ObjetParId(id0).title = bulle
Next
window.document.body.style.cursor = "default"
End Sub
Sub Reduire(id)
ObjetParId(id).innerText = "[+] "
ObjetParId(id & "f").innerText = ""
AfficherContenu id
End Sub
Sub Developper(id)
On Error Resume Next
dim path, fld, fldc, degree, espace, i, sfld, id1, id2, id3, id0, n, sfldc
path = Normaliser(ObjetParId(id & "c").innerText)
Set fld = Fso.GetFolder(path)
Set fldc = fld.SubFolders
If fldc.Count = 0 Then
ObjetParId(id).style.visibility = "hidden"
Else
ObjetParId(id).innerText = "[-] "
ObjetParId(id & "f").innerText = ""
degre = CompterOccurence(id,"_")
espace = Space(5 * (degre + 1))
espace = Replace(espace," "," ")
i = 0
For Each sfld in fldc
i = i + 1
id1 = id & "_" & i
id0 = id1 & "h"
id2 = id1 & "d"
id3 = id1 & "f"
fonction1 = "ExaminerPlus(" & chr(34) & id1 & chr(34) & ")"
fonction2 = "Explorer(" & chr(39) & id1 & chr(39) & ")"
n = "<div id=" & id0 & "><nobr><a>" & espace & "</a>"
n = n & "<a href=# class=plus id=" & id1 & " onClick=" & fonction1 & ">[+] </a>"
n = n & "<a href=# class=dossier id=" & id2 & " onClick=" & fonction2 & ">" & sfld.Name & "</a></nobr>"
n = n & "<font id=" & id3 & "></font></div>"
ObjetParId(id & "f").insertAdjacentHTML "BeforeEnd", n
Set sfldc = sfld.SubFolders
If sfldc.Count = 0 Then
ObjetParId(id1).style.visibility = "hidden"
End If
Enregistrer id1, sfld.Path
Next
End If
End Sub
Sub FiltrerTouche
If window.event.keyCode = 13 Then
window.event.returnValue = false
OuvrirDossier(window.dossierActuel.value)
Else
window.event.returnValue = true
End If
End Sub
Sub OuvrirDossier(p)
Dim path, path2, id, id2, i, dc, d, dossier, sousDossier, fld, fldc, sfld
path = Fso.GetAbsolutePathName(p)
path = Normaliser(path)
If Fso.FolderExists(path) Then
id = ""
i = 0
Set dc = Fso.Drives
For Each d in dc
i = i + 1
If UCase(d.DriveLetter) = UCase(Left(path,1)) Then
id = "d" & i
Exit For
End If
Next
dossier = ""
path2 = ""
sousDossier = ""
Do
dossier = Left(path,InStr(Len(dossier)+1,path,"\"))
If dossier = path Then
Exit Do
End If
path2 = Replace(path,dossier,"",1,1)
sousDossier = Left(path2,InStr(path2,"\")-1)
Set fld = Fso.GetFolder(dossier)
Set fldc = fld.SubFolders
i = 0
For Each sfld in fldc
i = i + 1
If sfld.Name = sousDossier Then
id = id & "_" & i
Exit For
End If
Next
Loop
id2 = id
Do
If ObjetExistant(id2) Then
Explorer id2
Exit Do
Else
id2 = Left(id2,InStrRev(id2,"_")-1)
End If
Loop
id = id & "_"
Do Until id = id2 & "_"
id2 = Left(id,InStr(Len(id2)+2,id,"_")-1)
Developper id2
Loop
AfficherContenu id2
Else
alert "Dossier introuvable"
End If
End Sub
agrandie = false
reduit = false
Sub ReduireFenetre
If reduit Then
If agrandie Then
AgrandirFenetre
Else
RestaurerFenetre
End If
window.boutonReduire.title = "Réduire"
Else
x2 = window.dossierActuel.offsetWidth + window.controleFenetre.offsetWidth + 10
y2 = window.dossierActuel.offsetHeight + 10
window.resizeTo x2,y2
x2 = window.screen.availWidth - x2
y2 = window.screen.availHeight - y2
window.moveTo x2,y2
If agrandie Then
window.boutonReduire.title = "Agrandir"
Else
window.boutonReduire.title = "Niveau inférieur"
End If
End If
reduit = not reduit
End Sub
Sub AgrandirFenetre
w2 = window.screen.availWidth
h2 = window.screen.availHeight
window.resizeTo w2,h2
window.moveTo 0, 0
window.divDossier.style.height = h2 - 80
With window.divContenu.style
.height = h2 - 80
.width = w2 - window.divDossier.offsetWidth - 25
End With
With window.fond
.style.left = 0
.style.top = 0
End With
window.boutonAgrandir.title = "Niveau inférieur"
End Sub
Sub RestaurerFenetre
window.resizeTo w,h
window.moveTo x,y
window.divDossier.style.height = h - 80
With window.divContenu.style
.height = h - 80
.width = w - window.divDossier.offsetWidth - 25
End With
With window.fond
.style.left = -x
.style.top = -y
End With
window.boutonAgrandir.title = "Agrandir"
End Sub
Sub Initialiser
With window.fond
.src = bgpath
.width = window.screen.width
.height = window.screen.height
End With
RestaurerFenetre
ListerLecteurs
OuvrirDossier ""
End Sub
Sub AgrandirOuRestaurer
If window.fond.offsetLeft = 0 Then
RestaurerFenetre
Else
AgrandirFenetre
End If
agrandie = not agrandie
reduit = false
End Sub
</script>
</head>
<body onLoad="Initialiser()">
<img id="fond">
<input type="text" id="dossierActuel" size=40 onKeypress="FiltrerTouche()">
<div id="controleFenetre"><table cellspacing=5>
<td><div class="carre" id="boutonReduire" onMouseOver="this.style.filter='Alpha(opacity=100)'" onMouseOut="this.style.filter = 'Alpha(opacity=70)'" onClick="ReduireFenetre()" title="Réduire">_</div></td>
<td><div class="carre" id="boutonAgrandir" onMouseOver="this.style.filter='Alpha(opacity=100)'" onMouseOut="this.style.filter = 'Alpha(opacity=70)'" onClick="AgrandirOuRestaurer()" title="Agrandir"></div></td>
<td><div class="carre" id="boutonFermer" onMouseOver="this.style.filter='Alpha(opacity=100)'" onMouseOut="this.style.filter = 'Alpha(opacity=70)'" onClick="window.close()" title="Fermer">X</div></td>
</table></div>
<h3 id="titreDossier" class="titre">Dossiers</h3>
<div id="divDossier"><h3 id="dossiers"></h3></div>
<h3 id="titreContenu" class="titre">Contenus</h3>
<div id="divContenu"><h3 id="contenus"></h3></div>
<div id="chemin"></div>
</body>
</html>