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
|
Dim sgMsg ' variable globale contenant le message de la fenetre IE
sgMsg = ""
sgMsg = sgMsg & "<SELECT ID=""nom"" MULTIPLE>"
sgMsg = sgMsg & "<OPTION> choix1 </OPTION>"
sgMsg = sgMsg & "<OPTION> choix2 </OPTION>"
sgMsg = sgMsg & "<OPTION> choix3 </OPTION>"
sgMsg = sgMsg & "</SELECT>"
' Affichage du message de proposition des fichiers volumineux
Dim tgBoutons(1) ' Les boutons de la fenetre IE
Dim sgResult ' Le bouton sur lequel l'utilisateur a cliqué
tgBoutons(0) = "Supprimer"
tgBoutons(1) = "Terminer"
sgResult = MsgBox_FT_Standard("Automatisation du Poste de Travail", "Assistant de vérifiaction de l'espace utilisé sur le lecteur réseau.", sgMsg, tgBoutons, 340)
' Supprimer les fichiers séléctionnés
If sgResult=0 Then
' recuperer ceux de la liste multiple <<<<<<<ICI>>>>>>>
WScript.Echo "SUPPRESSION"
End If
// voila la fonction pour faire la fenetre :
' Affiche les message sous InternetExplorer
Function MsgBox_FT_Standard(Titre,sgLibelle1,sgLibelle2,boutons,hauteur)
On Error Resume next
Dim olIE
Dim olBrowser
Dim ilCompteur
'initialisation de la variable test
MsgBox_FT_Standard=-1
Do While (MsgBox_FT_Standard= -1)
'on trappe les erreurs
On Error Resume Next
'on affiche IE, c'est pas grave si il existe pas encore
WScript.Sleep 200
'on capte la valeur donnée par IE
MsgBox_FT_Standard=olBrowser.Script.CheckVal()
'la première fois erreur 424 car olIE n'est pas encore défini
'après, à chaque fois que le user clique sur la croix, ça reouvre un IE pour l'obliger à faire un choix
If Err <> 0 Then
Set olIE = WScript.CreateObject("InternetExplorer.Application", "IE_")
olIE.Left = 200
olIE.Top =300
olIE.Height = hauteur
olIE.Width = 750
olIE.ToolBar = 0
olIE.StatusBar = 0
olIE.Visible = 0
olIE.navigate "about:blank"
Set olBrowser= olIE.Document
olBrowser.open
'écriture formulaire HTML
olBrowser.writeln "<html>"
olBrowser.writeln "<head>"
olBrowser.writeln "<title>"&Titre&"</title>"
olBrowser.writeln "<STYLE TYPE=""text/css"">"
olBrowser.writeln " body {"
olBrowser.writeln " font-family: Verdana;"
olBrowser.writeln " font-size: 10 pt }"
olBrowser.writeln " h1, h2, h3, h4, h5, h6 { font-family: Verdana }"
olBrowser.writeln "</STYLE>"
olBrowser.writeln "</head>"
olBrowser.writeln "<body bgcolor=""#99CCFF"" scroll=""no"">"
olBrowser.writeln "<script language=""VBScript"">"
olBrowser.writeln "<!--"
olBrowser.writeln "Dim ready "
For ilCompteur = 0 To UBound(boutons)
olBrowser.writeln "Sub B"&ilCompteur&"_OnClick"
olBrowser.writeln "ready="&ilCompteur
olBrowser.writeln "End Sub"
next
' Initialisation
olBrowser.writeln "Sub Window_OnLoad()"
olBrowser.writeln "ready=-1"
olBrowser.writeln "End Sub"
' Fonction utilisable de l'extérieur pour tester l'envoi
olBrowser.writeln "Public Function CheckVal()"
olBrowser.writeln "CheckVal=ready"
olBrowser.writeln "End function"
olBrowser.writeln "'-->"
olBrowser.writeln "</script>"
olBrowser.writeln "<form name=""RebootForm"">"
olBrowser.writeln "<h3><center>"&sgLibelle1&"</center></h3><hr>"
olBrowser.writeln "<br>"&sgLibelle2&" </br>"
If UBound(boutons) <>0 then
olBrowser.writeln "<hr></hr>"
End if
olBrowser.writeln "<center>"
For ilCompteur = 0 To UBound(boutons)
olBrowser.writeln "<input type=""button"" value="""&boutons(ilCompteur)&""" name=""B"&ilCompteur&""">"
Next
olBrowser.writeln "<hr>"
olBrowser.writeln "<center>"
olBrowser.writeln "<center>"
olBrowser.writeln "</center>"
olBrowser.writeln "</form>"
olBrowser.writeln "</body>"
olBrowser.writeln "</html>"
olIE.refresh
MsgBox_FT_FichiersVolumineux_Valide=-1
End If
olIE.Visible = 2
Loop
' Fermeture d'Internet Explorer
olIE.Quit
Set olIE = Nothing
WScript.Sleep 200 'pour éviter les pbs lors de deux appels successifs
End Function |
Partager