HLP Please
This is the script that I got from the net but it dose not work with space name ??
Dim ShellApp, Ret, s, i
Set ShellApp = CreateObject("Shell.Application")
On Error Resume Next
Set Ret = ShellApp.BrowseForFolder(0, "Choose file.", 16384)
s = Ret.title
If Err.number <> 0 Then
MsgBox "Cancelled"
WScript.Quit
End If
s = GetPath(Ret, i)
MsgBox s & "-" & cstr(i)
'--show full path and type of item returned. 0-namespace. 1-drive. 2-folder. 3-file.
Set ShellApp = nothing
WScript.Quit
Function GetPath(Fil, iItem)
Dim Pt1, fPar, sn, Obj, sType
On Error Resume Next
sn = Fil.title
Set fPar = Fil.parentfolder
Set Obj = fPar.parsename(sn) '--return item selected as a Shell FolderItem.
If Obj.isfilesystem = false Then
Pt1 = instr(sn, ":")
If Pt1 = 0 Then
iItem = 0 '--namespace.
getpath = sn
Else
iItem = 1 '--drive.
getpath = mid(sn, (Pt1 - 1), 2) & "\"
End If
Set Obj = nothing
exit Function
End If
sType = Obj.type '--Get object Type as shown in folder Details view.
If instr(sType, "Folder") = 0 Then
iItem = 3 '--file.
Else
iItem = 2 '--folder.
End If
getpath = Obj.path
Set Obj = nothing
End Function



Help
Back to top








