;; INSTALIT SCRIPT FILE TWES.INF
DefineVariables
    Text [Abbrev1] := E
    Text [Abbrev2] := S
    Text [Language1] := ENGLISH
    Text [Language2] := SPANISH
    Text [LanguageChoice1] := English (Anglais)
    Text [LanguageChoice2] := Spanish (Espanol)
    Number [MinimumSpaceRequired] := 11000000

    Text [DefinitionFileName] := [Abbrev1][Abbrev2]B.DEF
    Text [GlobalDefinitionFileName] := PT2.DEF

    Text [Series1] := TW[Abbrev1][Abbrev2]

    Directory [SDFSourceFileName] := [Abbrev1][Abbrev2].SDF
    Directory [SDFTargetFileName] := [Abbrev2][Abbrev1].SDF
    Directory [LRMSourceFileName] := [Language1].LRM
    Directory [LRMTargetFileName] := [Language2].LRM
    Directory [SDFFileName] := [SDFSourceFileName]
    Text [PromptLanguage] :=

    Directory [ReadmeFileName] :=

    Directory [DefaultSystemDirectory] := TWTRANS
    Directory [DefaultDictionaryDirectory] := TWTRANS

    Text [SystemInstallDrive] :=

    Directory [SystemInstallDirectory] :=
    Directory [SWDirectory] :=
    Directory [SUDirectory] :=

    Directory [RootDirectory] :=

    Logical [InstallSystem] := NoCharacter
    Logical [InstallDictionaries] := NoCharacter

    Logical [Installed] := NoCharacter

    Logical [OfferInstallationDirectoryChoice] := NoCharacter

    Text [HardDriveSelection] := RequireFixed DisallowNetwork NoGray ConfirmRAM

    Directory [ProgramToRun] := HDINST.EXE

    Text [MinimumOSVersion] := 3.0
    Number [MinimumSystemMemoryRequiredPresent] := 639
    Logical [AllowCGA] := YesCharacter
    Logical [AllowMDA] := YesCharacter
    Logical [Allow808x] := YesCharacter
    Logical [Allow80286] := YesCharacter
    Logical [MathCoprocessorRecommended] := NoCharacter
    Text [NetWorkInstallation] := DisAllowNetwork
    Text [DisplayAdapterSummary]
    Text [CPUTypeSummary]
    Text [NetworkActive]
    Text [MathCoprocessorStatus]
    Text [InstallationDriveSummary]
    Text [OSVersionSummary]
    Text [SystemMemorySummary]
    Logical [InsufficientSystem] := NoCharacter
    Logical [CompatibilityNoticeGiven] := NoCharacter
    Logical [Monochrome] := NoCharacter

    Number [MinimumFilesSetting] := 25
    Number [MinimumBuffersSetting] := 8
    Logical [AddInstallDirectoryToPath] := YesCharacter
    Logical [InquireAboutSystemFileLocation] := YesCharacter

    Text [ModifyMode] := Undecided

    Logical [UseShadows] := YesCharacter
    Text [MainBorder] := None
    Text [PopupBorder] := Single
    Text [TopLineColors] := WhiteOnMagenta
    Text [BottomLineColors] := WhiteOnMagenta
    Text [PopupColors] := BlackonLightGray
    Text [AttentionColors] := WhiteOnRed
    Text [SpecialPopupColors] := WhiteOnBrown
    Text [ExtractionOptions] := OnePerLine
    Text [BackgroundCharacter] := 20
    Text [ScreenColors] := WhiteOnBlue
    Text [BottomLine]

    SDF Text [CompanyName]
    SDF Text [ProductName]
    SDF Text [ExitMessage]
    SDF Text [TopLine]
    SDF Text [BottomBar]

    SDF Text [MainMenuTitle]
    SDF Text [MainMenuBox1L1]
    SDF Text [MainMenuBox1L2]

    SDF Text [MainMenuBox2L1]
    SDF Text [MainMenuBox2L2]
    SDF Text [MainMenuBox2L3]
    SDF Text [MainMenuBox2L4]
    SDF Text [MainMenuBox2L5]
    SDF Text [MainMenuBox2L6]
    SDF Text [MainMenuBox2L7]
    SDF Text [MainMenuBox2L8]

    SDF Text [ExpressSetupOption]
    SDF Text [ExpressSetupDescription]
    SDF Text [Module1Name]
    SDF Text [Module1Description]
    SDF Text [Module3Name]
    SDF Text [Module3Description]

    SDF Text [SystemDriveL1]
    SDF Text [SystemDriveL2]
    SDF Text [SystemDriveL3]
    SDF Text [DictionaryDriveL1]
    SDF Text [DictionaryDriveL2]
    SDF Text [DictionaryDriveL3]
    SDF Text [DictionaryDriveL4]
    SDF Text [SemanticDriveL1]
    SDF Text [SemanticDriveL2]
    SDF Text [SemanticDriveL3]
    SDF Text [SemanticDriveL4]

    SDF Text [InsufficientSystemL1]
    SDF Text [InsufficientSystemL2]
    SDF Text [InsufficientSystemL3]
    SDF Text [InsufficientSystemL4]

    SDF Text [UnabletoInstall]

    SDF Text [HelpL1]
    SDF Text [HelpL2]
    SDF Text [HelpL3]
    SDF Text [HelpL4]
    SDF Text [HelpL5]
    SDF Text [HelpL6]

    SDF Text [SummaryTitle]
    SDF Text [IncompatibleMessage]
    SDF Text [OSLine]
    SDF Text [OSVersionMessage]
    SDF Text [CPULine]
    SDF Text [CPUMessage]
    SDF Text [MicroChannel]
    SDF Text [ISA]
    SDF Text [Display]
    SDF Text [DisplayMessage]
    SDF Text [MathCo]
    SDF Text [MathCoMessage1]
    SDF Text [MathCoMessage2]
    SDF Text [MainMem]
    SDF Text [MainMemMessage]
    SDF Text [ExtMem]
    SDF Text [XMSMem]
    SDF Text [Network]
    SDF Text [DriveMessage]
    SDF Text [NoNetworkDrive]

    SDF Text [DefFileStatus]
    SDF Text [LDefFileStatus]

    SDF Text [BootFileL1]
    SDF Text [BootFileL2]
    SDF Text [BootFileL3]
    SDF Text [BootFileL4]

    SDF Text [Farewell]

    SDF Text [SystemDiskName]
    SDF Text [DictionaryDiskName]

    SDF Text [LanguageName]
    
EndDefineVariables

SetScreenAttrTo [ScreenColors]
SetBackgroundCharTo [BackgroundCharacter]
ClearScreen

Do ReadSDF

Do SetupInstalit

Do PrepareSystemReport

Do DealWithMonochromes


ClearScreen
:Again

SetBottomLineTo [BottomBar]

If [Monochrome] = NoCharacter
  Dialog PressAKey
    .c [MainMenuBox2L1]

    .c [MainMenuBox2L2]

    .c [MainMenuBox2L3]

    .c [MainMenuBox2L4]


    .c [MainMenuBox2L5]
    .c [MainMenuBox2L6]

    .c [MainMenuBox2L7]

    .c [MainMenuBox2L8]

  EndDialog
EndIf

ClearScreen
;;     Original source code
;;     DetermineInstallationDrive [MinimumSpaceRequired] [HardDriveSelection]


;; ------------------- added -----------------------------------------------
       
       QueFileGroup 1
       QueFileGroup 2

       DetermineInstallationDrive QueSize [HardDriveSelection]

       [YesOrNo6] := Y

       [Number1] := FreeSpaceOnDrive InstallationDrive
       if [Number1] < QueSize
         Dialog [YesOrNo6]
           If this is a new installation, there may not
           be sufficient space on drive InstallationDrive.

           Shall we continue?
         EndDialog
       EndIf

       If [YesOrNo6] = N
         UnQueAllFiles
         Do ReallyWereLeaving
         SoLong
       EndIF

       UnQueAllFiles

;; ------------------- added -----------------------------------------------

       SetBottomLineTo ""

       [SystemInstallDrive] := InstallationDrive:
       [SystemInstallDirectory] := InstallationDrive:\[DefaultSystemDirectory]

       [RootDirectory] := InstallationDrive:\

       [SWDirectory] := InstallationDrive:\[DefaultDictionaryDirectory]
       [SUDirectory] := InstallationDrive:\[DefaultDictionaryDirectory]
       [InstallSystem] := YesCharacter
       [InstallDictionaries] := YesCharacter

[Installed] := YesCharacter


Do InstallTheSystemDisk       ;; System diskette installation
Do FileModifications          ;; .DEF, CONFIG.SYS, AUTOEXEC.BAT mods 

If [Installed] = NoCharacter
  Dialog
    [UnabletoInstall]
  EndDialog
EndIf

:Continue
Do ReallyWereLeaving


Procedure ShowHelpInfo
  Dialog PressAKey [SpecialPopupColors]
    [HelpL1]
    [HelpL2]
    [HelpL3]

    [HelpL4]
    [HelpL5]
    [HelpL6]
  EndDialog
EndProcedure ;; ShowHelpInfo

Procedure ShowSystemSummary
  Dialog PressAKey [SpecialPopupColors]
    .c[SummaryTitle]
    .c[String8]  ;; notes whether any incompatibilities were found

    [OSLine]  [OSVersionSummary]
    [CPULine]  [CPUTypeSummary]
    [Display]  [DisplayAdapterSummary]
    [MathCo]  [MathCoprocessorStatus]
    [MainMem]  [SystemMemorySummary]
    [ExtMem]  ExtendedMemoryPresentK
    [XMSMem]  XMSMemoryAvailableK
    [Network]  [NetworkActive]
    [String9]  ;; information about network suitability
  EndDialog
EndProcedure ;; ShowSystemSummary

Procedure PrepareSystemReport
  [InsufficientSystem] := NoCharacter
  If OSVersion < [MinimumOSVersion]
    [OSVersionSummary] := OSVersion [OSVersionMessage]
    [InsufficientSystem] := YesCharacter
  else
    [OSVersionSummary] := OSVersion
  EndIf
  If MainMemory < [MinimumSystemMemoryRequiredPresent]
    [SystemMemorySummary] := MainMemoryK [MainMemMessage]
    [InsufficientSystem] := YesCharacter
  else
    [SystemMemorySummary] := MainMemoryK
  EndIf
  If 808X
    If [Allow808X] = YesCharacter
      [CPUTypeSummary] := 808x
    else
      [CPUTypeSummary] := 808x [CPUMessage]
      [InsufficientSystem] := YesCharacter
    EndIf
  EndIf
  If 80286
    [CPUTypeSummary] := 80286
  EndIf
  If 80386
    [CPUTypeSummary] := 80386
  EndIf
  If 80486
    [CPUTypeSummary] := 80486
  EndIf
  If [CPUTypeSummary] = BlankString
    [CPUTypeSummary] := 808x
  EndIf
  If MicroChannel
    [CPUTypeSummary] := [CPUTypeSummary] [MicroChannel]
  else
    [CPUTypeSummary] := [CPUTypeSummary] [ISA]
  EndIf
  If CGA
    If [AllowCGA] = YesCharacter
      [DisplayAdapterSummary] := CGA
    else
      [DisplayAdapterSummary] := CGA [DisplayMessage]
      [InsufficientSystem] := YesCharacter
    EndIf
  EndIf
  If MDA
    If [AllowMDA] = YesCharacter
      [DisplayAdapterSummary] := MDA
    else
      [DisplayAdapterSummary] := MDA [DisplayMessage]
      [InsufficientSystem] := YesCharacter
    EndIf
  Else

  EndIf
  If EGA
    [DisplayAdapterSummary] := EGA
  EndIf
  If VGA
    [DisplayAdapterSummary] := VGA
  EndIf
  If HGC
    [DisplayAdapterSummary] := HGC
  EndIf
  If HGCPlus
    [DisplayAdapterSummary] := HGC Plus
  EndIf
  If Network
    [NetworkActive] := Network Active
  else
    [NetworkActive] := No Network Active
  EndIf
  If NovellLoaded
    [NetworkActive] := Novell [NetworkActive]
  EndIf
  If [InstallationDirectory] <> BlankString
    [InstallationDriveSummary] := InstallationDrive (FreeSpaceOnDrive InstallationDrive bytes free)
  else
    [InstallationDriveSummary] := [DriveMessage]
  EndIf
  If MathCoprocessorPresent
    [MathCoprocessorStatus] := [MathCoMessage1]
  else
    [MathCoprocessorStatus] := [MathCoMessage2]
  EndIf

  If [InsufficientSystem] = YesCharacter
    [String8] := [IncompatibleMessage]
  EndIf
  If [NetworkInstallation] contains DisallowNetwork
    [String9] := [NoNetworkDrive]
  EndIf
  [CompatibilityNoticeGiven] := YesCharacter
EndProcedure ;; PrepareSystemReport

Procedure DealWithMonochromes
  If MDA
     [Monochrome] := YesCharacter
  Else
    If [CommandLine1] = "-m" 
       [Monochrome] := YesCharacter
    EndIf
    If [CommandLine1] = "/m" 
       [Monochrome] := YesCharacter
    EndIf
  EndIf
EndProcedure ;; DealWithMonochromes

Procedure FileModifications
  ClearScreen
  If [Installed] = YesCharacter
    If FileExists [SystemInstallDirectory]\[GlobalDefinitionFileName]
       TextBox
         [DefFileStatus]
       EndTextBox
       If [Monochrome] = YesCharacter
         run [InstallFromDrive]:\BINMOD [SystemInstallDirectory]\[GlobalDefinitionFileName] -q -o d0 -as '070000070700150015000700' NoPrompt Quietly
         run [InstallFromDrive]:\BINMOD [SystemInstallDirectory]\[GlobalDefinitionFileName] -q -o d24 -as '070000070700150015000700' NoPrompt Quietly
         run [InstallFromDrive]:\BINMOD [SystemInstallDirectory]\[GlobalDefinitionFileName] -q -o d48 -as '15001500' NoPrompt Quietly
       Else
         run [InstallFromDrive]:\BINMOD [SystemInstallDirectory]\[GlobalDefinitionFileName] -q -o d0 -as '150114041401140114011107' NoPrompt Quietly
         run [InstallFromDrive]:\BINMOD [SystemInstallDirectory]\[GlobalDefinitionFileName] -q -o d24 -as '140415011404150415041404' NoPrompt Quietly
         run [InstallFromDrive]:\BINMOD [SystemInstallDirectory]\[GlobalDefinitionFileName] -q -o d48 -as '15041401' NoPrompt Quietly
       EndIf
       ClearScreen
    EndIf  ;; PT2.DEF processing
  
    If FileExists [SystemInstallDirectory]\[DefinitionFileName]
       TextBox
         [LDefFileStatus]
       EndTextBox
       run [InstallFromDrive]:\BINMOD [SystemInstallDirectory]\[DefinitionFileName] -q -o d3 -as '[SWDirectory]' NoPrompt Quietly
       run [InstallFromDrive]:\BINMOD [SystemInstallDirectory]\[DefinitionFileName] -q -o d71 -as '[SUDirectory]' NoPrompt Quietly
       run [InstallFromDrive]:\BINMOD [SystemInstallDirectory]\[DefinitionFileName] -q -o d139 -as '[SWDirectory]' NoPrompt Quietly
       run [InstallFromDrive]:\BINMOD [SystemInstallDirectory]\[DefinitionFileName] -q -o d207 -as '[SUDirectory]' NoPrompt Quietly
       If [Monochrome] = YesCharacter
         run [InstallFromDrive]:\BINMOD [SystemInstallDirectory]\[DefinitionFileName] -q -o d277 -as '0700000715' NoPrompt Quietly
       Else
         run [InstallFromDrive]:\BINMOD [SystemInstallDirectory]\[DefinitionFileName] -q -o d277 -as '1401150412' NoPrompt Quietly
       EndIf
       ClearScreen
  
    EndIf ;; E?B.DEF processing

  
  EndIf
  
EndProcedure ;; FileModifications

Procedure ReallyWereLeaving
   SetBottomLineTo ""
   ClearScreen

   Dialog
      [Farewell]
   EndDialog
   SoLong
EndProcedure ;; ReallyWereLeaving

Procedure SetupInstalit
  If [UseShadows] = YesCharacter
    SetShadows On
  else
    SetShadows Off
  EndIf
  If [InquireAboutSystemFileLocation] = NoCharacter
    NoSysFileConfirmation
  EndIf
  SetMainBorderTo     [MainBorder]
  SetPopupBorderTo    [PopupBorder]
  SetModifyModeTo     [ModifyMode]
  SetShadowAttrTo     DarkGrayOnBlack
  SetScreenAttrTo     [ScreenColors]
  SetPopupAttrTo      [PopupColors]
  SetAttentionAttrTo  [AttentionColors]
  SetTopLineAttrTo    [TopLineColors]
  SetBottomLineAttrTo [BottomLineColors]
  SetTopLineTo        [TopLine]
  SetExitMessageTo    [ExitMessage]
  SetAllowExit        Off
  LetButton <F2> Do ShowSystemSummary
  LetButton <Esc> Do ReallyWereLeaving
  ClearScreen
EndProcedure ;; SetupInstalit



Procedure InstallTheSystemDisk

;; Put Batch File in Root Directory  (RsM)
  CopyFiles from [InstallFromDrive]:\ to [RootDirectory]  Quietly
    TWS.BAT
  EndCopyFiles

;;  CopyFiles from [InstallFromDrive]:\ to [SystemInstallDirectory] Quietly
;;    README.TXT
;;    TWS.BAT
;;  EndCopyFiles



;; This should put all the System Files and Dicts into the same directory
   If [InstallSystem] = YesCharacter
       InstallSeries [Series1] promptfor [SystemDiskName]
       QueFileGroup 1 to [SystemInstallDirectory] NoInquiry
       QueFileGroup 2 to [SystemInstallDirectory] IfNewer NoInquiry

       GetQuedFiles [ExtractionOptions]

       UnQueAllFiles
   EndIf
EndProcedure ;; InstallTheSystemDisk


Procedure ReadSDF
  [SDFFileName] := [SDFSourceFileName]
  [PromptLanguage] := [Language1]

  If FileExists [InstallFromDirectory]\[SDFFileName]
    TextBox BlackonLightGray
      Getting information for installation.

      One moment, please...
    EndTextBox
    ExamineTextFile [InstallFromDirectory]\[SDFFileName]

    [CompanyName] := SettingFor CompanyName
    [ProductName] := SettingFor ProductName
    [ExitMessage] := SettingFor ExitMessage
    [LanguageName] := SettingFor LanguageName
  
    [MainMenuTitle] := SettingFor MainMenuTitle
    [MainMenuBox1L1] := SettingFor MainMenuBox1L1
    [MainMenuBox1L2] := SettingFor MainMenuBox1L2
    [MainMenuBox2L1] := SettingFor MainMenuBox2L1
    [MainMenuBox2L2] := SettingFor MainMenuBox2L2
    [MainMenuBox2L3] := SettingFor MainMenuBox2L3
    [MainMenuBox2L4] := SettingFor MainMenuBox2L4
    [MainMenuBox2L5] := SettingFor MainMenuBox2L5
    [MainMenuBox2L6] := SettingFor MainMenuBox2L6
    [MainMenuBox2L7] := SettingFor MainMenuBox2L7
    [MainMenuBox2L8] := SettingFor MainMenuBox2L8


    [ExpressSetupOption] := SettingFor ExpressSetupOption
    [ExpressSetupDescription] := SettingFor ExpressSetupDescription
    [Module1Name] := SettingFor Module1Name
    [Module1Description] := SettingFor Module1Description
    [Module3Name] := SettingFor Module3Name
    [Module3Description] := SettingFor Module3Description
  
    [SystemDriveL1] := SettingFor SystemDriveL1
    [SystemDriveL2] := SettingFor SystemDriveL2
    [SystemDriveL3] := SettingFor SystemDriveL3
    [DictionaryDriveL1] := SettingFor DictionaryDriveL1
    [DictionaryDriveL2] := SettingFor DictionaryDriveL2
    [DictionaryDriveL3] := SettingFor DictionaryDriveL3
    [DictionaryDriveL4] := SettingFor DictionaryDriveL4
    [SemanticDriveL1] := SettingFor SemanticDriveL1
    [SemanticDriveL2] := SettingFor SemanticDriveL2
    [SemanticDriveL3] := SettingFor SemanticDriveL3
    [SemanticDriveL4] := SettingFor SemanticDriveL4
  
    [InsufficientSystemL1] := SettingFor InsufficientSystemL1
    [InsufficientSystemL2] := SettingFor InsufficientSystemL2
    [InsufficientSystemL3] := SettingFor InsufficientSystemL3
    [InsufficientSystemL4] := SettingFor InsufficientSystemL4
  
    [UnabletoInstall] := SettingFor UnabletoInstall
  
    [HelpL1] := SettingFor HelpL1
    [HelpL2] := SettingFor HelpL2
    [HelpL3] := SettingFor HelpL3
    [HelpL4] := SettingFor HelpL4
    [HelpL5] := SettingFor HelpL5
    [HelpL6] := SettingFor HelpL6
  
    [SummaryTitle] := SettingFor SummaryTitle
    [IncompatibleMessage] := SettingFor IncompatibleMessage
  
    [OSLine] := SettingFor OSLine
    [OSVersionMessage] := SettingFor OSVersionMessage
    [CPULine] := SettingFor CPULine
    [CPUMessage] := SettingFor CPUMessage
    [MicroChannel] := SettingFor MicroChannel
    [ISA] := SettingFor ISA
    [Display] := SettingFor Display
    [DisplayMessage] := SettingFor DisplayMessage
    [MathCo] := SettingFor MathCo
    [MathCoMessage1] := SettingFor MathCoMessage1
    [MathCoMessage2] := SettingFor MathCoMessage2
    [MainMem] := SettingFor MainMem
    [MainMemMessage] := SettingFor MainMemMessage
    [ExtMem] := SettingFor ExtMem
    [XMSMem] := SettingFor XMSMem
    [Network] := SettingFor Network
    [DriveMessage] := SettingFor DriveMessage
    [NoNetworkDrive] := SettingFor NoNetworkDrive

    [DefFileStatus] := SettingFor DefFileStatus
    [LDefFileStatus] := SettingFor LDefFileStatus

    [Farewell] := SettingFor Farewell

    [TopLine] := SettingFor TopLine
    [BottomBar] := SettingFor BottomBar

    [SystemDiskName] := SettingFor SystemDiskName
    [DictionaryDiskName] := SettingFor DictionaryDiskName

    [Module1Name] := SettingFor Module1Name
    [Module1Description] := SettingFor Module1Description
    [Module3Name] := SettingFor Module3Name
    [Module3Description] := SettingFor Module3Description
    [ExpressSetupDescription] := SettingFor ExpressSetupDescription

    ClearScreen       ;; get rid of textbox
    ForgetTextFile    ;; release memory consumed by ExamineTextFile
  Else
    Popup Script Data File [SDFFileName] is missing.  Cannot continue.
    SoLong
  EndIf

EndProcedure ;; ReadSDF

;; Procedure DisplayReadMe
;;   If [BrowseReadMe] = YesCharacter
;;     BrowseFile [SystemInstallDrive]\[DefaultSystemDirectory]\[ReadmeFileName] @xy(5,1) MaxXY(76,18) WhiteOnBrown 
;;     ClearScreen
;;   EndIf
;; EndProcedure ;; DisplayReadMe

