Advertisement
CGar

Install UT2004 map and resources

Oct 5th, 2015
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2.  
  3. Dim wSH, FSO, startDir, utLoc, Arch, utExe, utRegLoc, Fld, dst, File, ret, forceNext
  4.  
  5. Set FSO = CreateObject("Scripting.FileSystemObject")
  6. Set wSH = wScript.CreateObject("wScript.Shell")
  7.  
  8. ret = msgbox("Do you want to install (also overwrites/updates) the" & vbcrlf & _
  9. "Stargate Atlantis map and all its dependancies?" & vbcrlf & vbcrlf & _
  10. "  Yes - Installs and/or updates." & vbcrlf & _
  11. "  No - Cancels request and exits." & vbcrlf & vbcrlf & _
  12. "A message box will signal completion." & vbcrlf & vbcrlf & _
  13. "Install?", vbYesNo + vbDefaultButton1 + vbInformation, "Install/Update SGA Map")
  14.  
  15. If not ret = vbYes then wscript.Quit
  16.  
  17. utLoc = "C:\UT2004"
  18. Arch = GetObject("winmgmts:root\cimv2:Win32_Processor='cpu0'").AddressWidth
  19. startDir = left(WScript.ScriptFullName,(Len(WScript.ScriptFullName))-(len(WScript.ScriptName)))
  20.  
  21. If Arch = "64" Then
  22.    utRegLoc = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Unreal Technology\Installed Apps\UT2004\Folder"
  23. ElseIf Arch = "32" Then
  24.    utRegLoc = "HKEY_LOCAL_MACHINE\SOFTWARE\Unreal Technology\Installed Apps\UT2004\Folder"
  25. Else
  26.    ret = MsgBox("Cannot Determine OS Architecture! Try running again as admin?", vbCritical, "Error!")
  27.    wScript.Quit
  28. End If
  29.  
  30. utExe = utLoc & "\System\UT2004.exe"
  31. If Not FSO.FileExists(utExe) Then
  32.    utLoc = wSH.RegRead(utRegLoc)
  33.    utExe = utLoc & "\System\UT2004.exe"
  34.    If Not FSO.FileExists(utExe) Then
  35.       ret = MsgBox("Cannot find UT2004!", vbCritical, "Error!")
  36.       wScript.quit
  37.    End If
  38. End If
  39.  
  40. Set Fld = FSO.getfolder(startDir)
  41.  
  42. forceNext = false
  43.  
  44. For Each File In fld.files
  45.    Select Case ucase(right(File.Name, 4))
  46.       Case ".USX"
  47.          dst = utLoc & "\StaticMeshes\" & File.Name
  48.       Case ".UTX"
  49.          dst = utLoc & "\Textures\" & File.Name
  50.       Case ".UT2"
  51.          dst = utLoc & "\Maps\" & File.Name
  52.       Case ".UCL", "RV.U"
  53.          dst = utLoc & "\System\" & File.Name
  54.       Case ".UKX"
  55.          dst = utLoc & "\Animations\" & File.Name
  56.       Case Else
  57.          forceNext = true
  58.       End Select
  59.      
  60.       If not forceNext then
  61.          FSO.CopyFile File.Path, dst
  62.       else
  63.          forceNext = false
  64.       end if
  65. next
  66.  
  67. ret = Msgbox("File copy complete!", vbinformation, "SGA map install finished")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement