suite à cette discussion Variable Input Type Password ,ce petit HTA pour la compression et la sauvegarde avec 7zip a vu le jour ; mais il y a un petit bug c'est qu'on passant les paramètres du dossier à choisir il faut qu'il soit sans espaces.
Alors je cherche un truc ou une astuce pour contourner ce problème d'espaces.

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
<html>
<head>
<SCRIPT LANGUAGE="VBScript">
'=========================================================
'Fenêtre pour choisir le répertoire cible de la sauvegarde
'=========================================================
Const WINDOW_HANDLE = 0
BIF_editbox = &H0010
titre="Sélectionner la destination de la sauvegarde"
CenterWindow 260,180
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder _
    (WINDOW_HANDLE, titre , BIF_editbox)
On Error Resume Next
Set objFolderItem = objFolder.Self
If Err <> 0 Then
        msgbox "Annulation de la sauvegarde",48,"Annulation de la sauvegarde"
        fermer()
Else
        objPath = objFolderItem.Path
 
end If
 
sub compression
Set WshShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
oProgramFiles = WshShell.ExpandEnvironmentStrings("%PROGRAMFILES%")
chemin7zip = oProgramFiles &"\7-zip\7z.exe"
If Not fso.FileExists(chemin7zip) Then
MsgBox "Le " & chemin7zip & " n'existe pas",48,chemin7zip
WshShell.Run "http://www.spiroo.be/7zip/"
Call Fermer
Else
strCMD = "cmd /c cd %PROGRAMFILES%\7-zip & 7z.exe"
password = pass.value
MsgBox "Vous avez choisi le dossier " & qq(objPath) & " pour la sauvegarde",64,"Dossier Choisi "& qq(objPath)&"" 
Str7zip = strCMD & " u " & objPath &"\sauvegarde.zip " & objPath & " -p"&password
MsgBox Str7zip,64," Commande à exécuter !"
WshShell.Run Str7zip,1,True
MsgBox "L'archive : " & objPath &"\sauvegarde.zip est Crée avec Succès ! ",64,"sauvegarde.zip est Crée avec Succès !" 
Call Fermer
End If
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 Fermer
window.close()
End Sub
 
Function qq(strIn)
    qq = Chr(34) & strIn & Chr(34)
End Function
</script>
</head>
<title>Sauvegarde avec l'utilitaire 7-Zip</title>    
<HTA:APPLICATION ID="Sauvegarde avec l'utilitaire 7-Zip"
APPLICATIONNAME="Sauvegarde avec l'utilitaire 7-Zip"
CAPTION="Yes"
SHOWINTASKBAR="No"
SINGLEINSTANCE="yes"
SYSMENU="No"
SCROLL="no"
WINDOWSTATE="normal">
<center>
<body BGCOLOR="lightblue">
Mot de passe OBLIGATOIRE : <input type="password" size="20" name="pass" ID="pass"><br><br>
<input type="submit" id="BTvalider" name="valider" value="Continuer" onclick="compression()">
<input type="button" id="Fermer" value="Fermer" onclick="Fermer()">
</body>
</html>