Browse For Folder Dialog Box : selection drive fontionne pas ?
voici mon code, que j'utilise pour dezipper un fichier.
Hors avec le dialog box, j'aimerai selection un disque au lieu d'un folder.
Mais dans ce cas la fonction .... ne fonctionne pas ?
destination = objF.ParentFolder.ParseName(objF.Title).Path
Code:
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
|
Function IsValue(obj)
' Check whether the value has been returned.
Dim tmp
On Error Resume Next
tmp = " " & obj
If Err <> 0 Then
IsValue = False
Else
IsValue = True
End If
On Error GoTo 0
End Function
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("extract.vbs")
FolderName=objFSO.GetParentFolderName(objFile)
'wscript.echo Foldername
stFichierSource = CreateObject("htmlfile").ParentWindow.ClipboardData.Getdata("text")
Dim wsh, objDlg, objF
' Get Application object of the Windows shell.
Set objDlg = WScript.CreateObject("Shell.Application")
Set objF = objDlg.BrowseForFolder (&H0, _
"Select the folder to copy the Record Session to", &H4000, 17)
If IsValue(objF) Then
destination = objF.ParentFolder.ParseName(objF.Title).Path
wscript.echo destination
Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
Set oShell = WScript.CreateObject("Wscript.Shell")
oShell.Run FolderName&"\7za.exe x -y "&stFichierSource&".zip -o"&destination&"\", 0, True
End If |