OVH Cloud OVH Cloud

while.....vbs??

2 réponses
Avatar
HeLioZz
voila enfaite j voudrais faire une boucle qu executerait la condition que
tant que rep2=vbok faire la boucle (qui a pour variable item)le souci c que
je n arrive a trouver la bonne syntaxe ...voici le code :


Rep = MsgBox ("Etes vous sur de vouloir configurer le serveur pour les
sauvegardes ?", vbQuestion Or vbOkCancel, "lancement de la configuration du
serveur")
if Rep = vbOk then


BIF_returnonlyfsdirs = &H0001
BIF_dontgobelowdomain = &H0002
BIF_editbox = &H0010
BIF_validate = &H0020
BIF_browseforcomputer = &H1000

Dim shell, item
Set shell = WScript.CreateObject("Shell.Application")
flag=BIF_returnonlyfsdirs
titre="Sélectionnez un dossier"

Set Item = shell.BrowseForFolder(0,titre,flag, dirinit)


else
MsgBox "vous avez cliqué sur annuler !",vbInformation + vbOkOnly +
vbApplicationModal + 0,"annulation" &wscript.quit
end if

If isvalue(Item) Then
Result=Item.Title

If InStr(1,Result,":")=0 Then
Result=Item.ParentFolder.ParseName(Item.Title).Path
End If

Dim filesys, testfile
Set filesys = CreateObject("Scripting.FileSystemObject")
Set testfile= filesys.CreateTextFile("c:\direction.txt", True)
testfile.WriteLine result
testfile.Close

else
MsgBox "vous avez cliqué sur annuler !",vbInformation + vbOkOnly +
vbApplicationModal + 0,"annulation" &wscript.quit

End If



Function IsValue(obj)
Dim tmp
On Error Resume Next
tmp = " " & obj
If Err <> 0 Then IsValue = False Else IsValue = True
On Error GoTo 0
End Function

rep2=MsgBox("voulez vous reselectionner des fichiers a sauvegarder
?",vbQuestion + vbOKCancel + vbApplicationModal + 0,"resaisir ")
Do While rep2 = vbok
item
Loop

2 réponses

Avatar
Jean
voila enfaite j voudrais faire une boucle qu executerait la condition que
tant que rep2=vbok faire la boucle (qui a pour variable item)le souci c que
je n arrive a trouver la bonne syntaxe ...voici le code :


Rep = MsgBox ("Etes vous sur de vouloir configurer le serveur pour les
sauvegardes ?", vbQuestion Or vbOkCancel, "lancement de la configuration du
serveur")
if Rep = vbOk then


BIF_returnonlyfsdirs = &H0001
BIF_dontgobelowdomain = &H0002
BIF_editbox = &H0010
BIF_validate = &H0020
BIF_browseforcomputer = &H1000

Dim shell, item
Set shell = WScript.CreateObject("Shell.Application")
flag=BIF_returnonlyfsdirs
titre="Sélectionnez un dossier"

Set Item = shell.BrowseForFolder(0,titre,flag, dirinit)


else
MsgBox "vous avez cliqué sur annuler !",vbInformation + vbOkOnly +
vbApplicationModal + 0,"annulation" &wscript.quit
end if

If isvalue(Item) Then
Result=Item.Title

If InStr(1,Result,":")=0 Then
Result=Item.ParentFolder.ParseName(Item.Title).Path
End If

Dim filesys, testfile
Set filesys = CreateObject("Scripting.FileSystemObject")
Set testfile= filesys.CreateTextFile("c:direction.txt", True)
testfile.WriteLine result
testfile.Close

else
MsgBox "vous avez cliqué sur annuler !",vbInformation + vbOkOnly +
vbApplicationModal + 0,"annulation" &wscript.quit

End If



Function IsValue(obj)
Dim tmp
On Error Resume Next
tmp = " " & obj
If Err <> 0 Then IsValue = False Else IsValue = True
On Error GoTo 0
End Function

rep2=MsgBox("voulez vous reselectionner des fichiers a sauvegarder
?",vbQuestion + vbOKCancel + vbApplicationModal + 0,"resaisir ")
Do While rep2 = vbok
item
Loop


Ce serait plus simple de dire ce que vous voulez faire ... 9 chances
sur 10 il y a un script tout fait dans le Script Center ...

Amicalement,

--
Jean - JMST
Belgium

Avatar
Do Re Mi chel La Si Do
Bonsoir !


Je n'avais rien compris à la question. Mais je n'osais pas l'avouer.

Merci, Jean, d'être passé par là...


@-salutations

Michel Claveau