diff options
| author | Petr Mrázek | 2012-01-01 22:46:53 +0100 |
|---|---|---|
| committer | Petr Mrázek | 2012-01-01 22:46:53 +0100 |
| commit | 6df617e7668717574e3708c1681332ce5a6034c1 (patch) | |
| tree | d6015247b533a8e0041406c994b4d73230d80ff6 /build/set_df_path.vbs | |
| parent | 6476d61e59e7b49a2e0afb2cac3e19768573cb0e (diff) | |
| download | dfhack-6df617e7668717574e3708c1681332ce5a6034c1.tar.gz dfhack-6df617e7668717574e3708c1681332ce5a6034c1.tar.bz2 dfhack-6df617e7668717574e3708c1681332ce5a6034c1.tar.xz | |
Many more build scripts for windows
Diffstat (limited to 'build/set_df_path.vbs')
| -rw-r--r-- | build/set_df_path.vbs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/build/set_df_path.vbs b/build/set_df_path.vbs new file mode 100644 index 00000000..1d494a2e --- /dev/null +++ b/build/set_df_path.vbs @@ -0,0 +1,32 @@ +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) + +Set fso = CreateObject("Scripting.FileSystemObject") +If fso.FileExists("DF_PATH.txt") Then + fso.DeleteFile "DF_PATH.txt", True +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) + 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 +End Function
\ No newline at end of file |
