On Error Resume Next
Dim OShell, oArgs, filedir, outf, fso, X, Y
Set oArgs = WScript.Arguments
Const ForWriting = 2
X = "Purpose of script is for an unattended install of:" & vbcrlf
X = X & vbcrlf
if WScript.Version < "5.7" Then  ' Vista returns 5.7, XP returns 5.6
   X = X & "1. .Net Framework 2 - DO NOT install if using Vista" & vbcrlf
   X = X & "2. Fujitsu .Net Run time files" & vbcrlf
   X = X & "3. LBASystems Application"  & vbcrlf
   X = X & "4. Adobe Reader 7.08" & vbcrlf
else
   X = X & "1. Fujitsu .Net Run time files" & vbcrlf
   X = X & "2. LBASystems Application"  & vbcrlf
   X = X & "3. Adobe Reader 7.08" & vbcrlf
End if
X = X & vbcrlf
X = X & "Arguments or Parameters:" & vbcrlf
X = X & "1. Name of 'Root Folder'for Application Data Files"  & vbcrlf
X = X & vbcrlf
X = X & "Assumptions:" & vbcrlf
X = X & "1. All files are in the same folder as this script" &vbcrlf
X = X & "2. Permissions allow a text file to be created"  & vbcrlf
X = X & "3. None of the software is on the target machine" & vbcrlf
X = X & "Amend if that is not the case" & vbcrlf
X = X & vbcrlf
X = X & "Files used in the install:" & vbcrlf
if WScript.Version < "5.7" Then
   X = X & "1. dotnetfx.exe (.Net Framework 2.0)  - DO NOT install if using Vista" & vbcrlf
   X = X & "2. setup.exe (Fujitsu Runtime file(1))" & vbcrlf
   X = X & "3. ISScript1050.Msi (Fujitsu Runtime file(2))" & vbcrlf
   X = X & "4. LBASystems_121.exe (LBASystems Application)" & vbcrlf
   X = X & "5. AdbeRdr708_en_US.exe (Abobe Reader Setup)" & vbcrlf
else
   X = X & "1. setup.exe (Fujitsu Runtime file(1))" & vbcrlf
   X = X & "2. ISScript1050.Msi (Fujitsu Runtime file(2))" & vbcrlf
   X = X & "3. LBASystems_121.exe (LBASystems Application)" & vbcrlf
   X = X & "4. AdbeRdr708_en_US.exe (Abobe Reader Setup)" & vbcrlf
end if
X = X & vbcrlf
X = X & "Notes:" &vbcrlf
if WScript.Version < "5.7" Then
   X = X & "Files 2 and 3 are in a zip file (Fujitsu_Redist.zip) which needs" & vbcrlf
   X = X & "to be unzipped before running this script" & vbcrlf
else
   X = X & "Files 1 and 2 are in a zip file (Fujitsu_Redist.zip) which needs" & vbcrlf
   X = X & "to be unzipped before running this script" & vbcrlf
end if
X = X & "The name of the Adobe Reader file may vary a little" & vbcrlf
 
if oArgs.count = 0 then
   return = msgbox(X, VBOKonly, "Instructions")
   Wscript.quit
end if
set fso = CreateObject("Scripting.FileSystemObject")
filedir = oArgs(0)
Set OShell = WScript.CreateObject("WScript.Shell")

if WScript.Version < "5.7" then  ' Vista returns 5.7, XP Returns 5.6
    ' Install .Net Framework 2  - DO NOT install if using Vista
    Return = OShell.run("cmd /c dotnetfx.exe /q:a /c:" & chr(34) & "install /l /q" & chr(34), 2, True)
end if

if fso.FileExists("C:\Program Files\Common Files\Fujitsu NetCOBOL for .NET Runtime V3.0\Utilities\cobfattr.exe") Then
else
   ' Install Fujitsu .Net Run time files
   Return = OShell.run("cmd /c Setup.exe /S /q /V" & chr(34) & "ADDLOCAL=ALL /quiet" & chr(34), 2, True)
end if

' Install LBASystems Application
X = fso.getfolder(".")
set outf = fso.OpenTextFile(X & "\lbavars.ini", ForWriting, true)
outf.Writeline("[SetupValues]")
outf.Writeline("%ApplicationDataFolder% = " & filedir)
outf.close
Y = "cmd /c LBASystems_121.exe " &  "/S:" & X & "\lbavars.ini"
Return = OShell.run(Y, 2, True)

if fso.FileExists("C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe") Then
else
   ' Install Adobe Reader 7.08
   Return = Oshell.run("cmd /c AdbeRdr708_en_US.exe /S /v /qn /V" & chr(34) & "/quiet" & chr(34), 2, True)
end if
