set-df-path: accept path on command line

develop
Kelly Kinkade 2023-01-06 08:31:54 -06:00
parent 1540e7c294
commit 42d572cd03
2 changed files with 22 additions and 8 deletions

@ -2,11 +2,18 @@ Option Explicit
Const BIF_returnonlyfsdirs = &H0001
Dim wsh, objDlg, objF, fso, spoFile
Set objDlg = WScript.CreateObject("Shell.Application")
Set objF = objDlg.BrowseForFolder (&H0,"Select your DF folder", BIF_returnonlyfsdirs)
Dim wsh, objDlg, objF, fso, spoFile, args
Set fso = CreateObject("Scripting.FileSystemObject")
set args = Wscript.Arguments
if args.count > 0 Then
Set ObjF = fso.GetFolder(args.Item(0))
else
Set objDlg = WScript.CreateObject("Shell.Application")
Set objF = objDlg.BrowseForFolder (&H0,"Select your DF folder", BIF_returnonlyfsdirs).Self
end if
If fso.FileExists("DF_PATH.txt") Then
fso.DeleteFile "DF_PATH.txt", True
End If
@ -14,7 +21,7 @@ End If
If IsValue(objF) Then
If InStr(1, TypeName(objF), "Folder") > 0 Then
Set spoFile = fso.CreateTextFile("DF_PATH.txt", True)
spoFile.WriteLine(objF.Self.Path)
spoFile.WriteLine(objF.Path)
End If
End If

@ -2,11 +2,18 @@ Option Explicit
Const BIF_returnonlyfsdirs = &H0001
Dim wsh, objDlg, objF, fso, spoFile
Set objDlg = WScript.CreateObject("Shell.Application")
Set objF = objDlg.BrowseForFolder (&H0,"Select your DF folder", BIF_returnonlyfsdirs)
Dim wsh, objDlg, objF, fso, spoFile, args
Set fso = CreateObject("Scripting.FileSystemObject")
set args = Wscript.Arguments
if args.count > 0 Then
Set ObjF = fso.GetFolder(args.Item(0))
else
Set objDlg = WScript.CreateObject("Shell.Application")
Set objF = objDlg.BrowseForFolder (&H0,"Select your DF folder", BIF_returnonlyfsdirs).Self
end if
If fso.FileExists("DF_PATH.txt") Then
fso.DeleteFile "DF_PATH.txt", True
End If
@ -14,7 +21,7 @@ End If
If IsValue(objF) Then
If InStr(1, TypeName(objF), "Folder") > 0 Then
Set spoFile = fso.CreateTextFile("DF_PATH.txt", True)
spoFile.WriteLine(objF.Self.Path)
spoFile.WriteLine(objF.Path)
End If
End If