2012-01-01 14:46:53 -07:00
|
|
|
Option Explicit
|
|
|
|
|
|
|
|
Const BIF_returnonlyfsdirs = &H0001
|
|
|
|
|
2023-01-06 07:31:54 -07:00
|
|
|
Dim wsh, objDlg, objF, fso, spoFile, args
|
2012-01-01 14:46:53 -07:00
|
|
|
|
|
|
|
Set fso = CreateObject("Scripting.FileSystemObject")
|
2023-01-06 07:31:54 -07:00
|
|
|
|
|
|
|
set args = Wscript.Arguments
|
|
|
|
if args.count > 0 Then
|
|
|
|
Set ObjF = fso.GetFolder(args.Item(0))
|
|
|
|
else
|
|
|
|
Set objDlg = WScript.CreateObject("Shell.Application")
|
2023-01-06 11:01:01 -07:00
|
|
|
Set objF = objDlg.BrowseForFolder (&H0,"Select your DF folder", BIF_returnonlyfsdirs)
|
|
|
|
if IsValue(objF) Then
|
|
|
|
set ObjF = objF.self
|
|
|
|
end if
|
2023-01-06 07:31:54 -07:00
|
|
|
end if
|
|
|
|
|
2012-01-01 14:46:53 -07:00
|
|
|
If fso.FileExists("DF_PATH.txt") Then
|
|
|
|
fso.DeleteFile "DF_PATH.txt", True
|
|
|
|
End If
|
|
|
|
|
2022-04-12 12:48:19 -06:00
|
|
|
If IsValue(objF) Then
|
2012-01-01 14:46:53 -07:00
|
|
|
If InStr(1, TypeName(objF), "Folder") > 0 Then
|
|
|
|
Set spoFile = fso.CreateTextFile("DF_PATH.txt", True)
|
2023-01-06 07:31:54 -07:00
|
|
|
spoFile.WriteLine(objF.Path)
|
2012-01-01 14:46:53 -07:00
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
|
|
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
|
2022-04-12 12:48:19 -06:00
|
|
|
End Function
|