  { SETUP.INS - CD-ROM Installation File - Windows-platform          }

  InstName := 'Essential Books on File Formats CD-ROM';
  Cls;
  StrRet := InstName;
  DoFunc(0);
  StrRet := 'FORMATS.BMP';
  DoFunc(26);


GetFrom:
  DoFunc(5);
  Mssg(6,3,'Enter the drive letter of your CD-ROM drive.');
  DoFunc(11);
  DoFunc(2);
  CDROMDrive := StrRet;
  BranchEq(IntRet,0,Leaving);
  BranchEq(IntRet,2,GetFrom);

GetDrive:
  DoFunc(5);
  Mssg(6,3,'Enter the drive letter of your hard disk.');
  StrRet := 'C';
  DoFunc(2);
  ToDrive := StrRet;
  BranchEq(IntRet,0,Leaving);
  BranchEq(IntRet,2,GetDrive);

GetPath:
  DoFunc(5);
  Mssg(6,3,'Enter the path to install the CD into.  The default');
  Mssg(6,4,'path is \FORMATS');
  StrRet := '\FORMATS';
  DoFunc(3);
  SysPath := '';
  Concat(SysPath,ToDrive,':',StrRet);
  ReadPath := SysPath

  DoFunc(5);
  Mssg(6,3,'You have specified the following:');
  a := '';
  Concat(a,'- CD-ROM is in Drive ',CDROMDrive,':');
  Mssg(6,5,a);
  a := '';
  Concat(a,'- Application will be installed into ',SysPath);
  Mssg(6,6,a);
  DoFunc(7);
  DoFunc(5);
  BranchEq(IntRet,0,Leaving);
  BranchEq(IntRet,2,GetFrom);
  BranchEq(IntRet,3,Leaving);

  {Check if they have (IntRet*2+100) Kilobytes available on their hard disk}
  IntRet := 2000;
  DoFunc(4);
  BranchEq(IntRet,0,Leaving);
  BranchEq(IntRet,2,Leaving);
  BranchEq(IntRet,3,Leaving);

  DoFunc(5);
  Mssg(6,3,'Installing CD-ROM start up batch file now:');

  {Make The Directories Here}
  Mssg(5,21,'Creating Directory...');
  ChDir(CDROMDrive,':');
  ChDir('\GBOOK');       {built in directory name on the CD}
  ChDir(ToDrive,':');
  MkDir(SysPath);
  ChDir(SysPath);

  StrRet := SysPath;
  DoFunc(6);
  ConCat(StrRet,'HRW.INI');

  IntRet := 0;
  DoFunc(23);
  BranchEq(IntRet,0,DoCopy);
  Goto Error;

DoCopy:
  {Mssg(5,21,'Modifying Initialization File...');}
  Copy(CDROMDrive,':\FORMATS\HRW.INI');

  IntRet := 0;
  DoFunc(23);
  BranchEq(IntRet,0,DoOpen);
  Goto Error;

DoOpen:
  DoFunc(18);
  BranchEq(IntRet,0,INIOpen);
  Goto Error;

INIOpen:
  StrRet := 'Document Path = ';
  Concat(StrRet,CDROMDrive,':\FORMATS');
  DoFunc(19);
  BranchEq(IntRet,0,Wrote1);
  Goto Error;

Wrote1:
  StrRet := 'Alternate Picture Path = ';
  Concat(StrRet,SysPath);
  DoFunc(19);
  BranchEq(IntRet,0,Wrote2);
  Goto Error;

Wrote2:
  StrRet := 'Text Path=';
  Concat(StrRet,SysPath);
  DoFunc(19);
  BranchEq(IntRet,0,Wrote3);
  Goto Error;

Wrote3:
  StrRet := 'Use Directories=2';
  DoFunc(19);
  BranchEq(IntRet,0,WroteINI);
  Goto Error;

WroteINI:
  DoFunc(20);
  BranchEq(IntRet,0,INIClose);
  Goto Error;

INIClose:
  StrRet := SysPath;
  DoFunc(6);
  ConCat(StrRet,'HRW.INI');
  IntRet := 1;
  DoFunc(23);
  BranchEq(IntRet,0,INIROOK);
  Goto Error;

INIROOK:

  {Copy Files}
  Copy(CDROMDrive,':\FORMATS\HRW.EXE');
  Copy(CDROMDrive,':\FORMATS\HRW.CFG');
  Copy(CDROMDrive,':\FORMATS\HRW.DIA');
  Copy(CDROMDrive,':\FORMATS\HWSYSTEM.VGA');
  Copy(CDROMDrive,':\FORMATS\CTL3D.DLL');
  Copy(CDROMDrive,':\FORMATS\IMAGES.DLL');
  Copy(CDROMDrive,':\FORMATS\IMGBMP.DIL');
  Copy(CDROMDrive,':\FORMATS\IMGEPSF.DIL');
  Copy(CDROMDrive,':\FORMATS\IMGJPG.DIL');
  Copy(CDROMDrive,':\FORMATS\IMGPCX.DIL');
  Copy(CDROMDrive,':\FORMATS\IMGTIFF.DIL');
  Copy(CDROMDrive,':\FORMATS\IMGWMF.DIL');
  Copy(CDROMDrive,':\FORMATS\MAIN.PCX');
  Copy(CDROMDrive,':\FORMATS\TOC_1.PCX');
  Copy(CDROMDrive,':\FORMATS\TOC_2.PCX');
  Copy(CDROMDrive,':\FORMATS\TOC_3.PCX');
  Copy(CDROMDrive,':\FORMATS\TOC_4.PCX');
  Copy(CDROMDrive,':\FORMATS\TOC_5.PCX');
  Copy(CDROMDrive,':\FORMATS\TOC_6.PCX');
  Copy(CDROMDrive,':\FORMATS\TOC_7.PCX');
  Copy(CDROMDrive,':\FORMATS\CLOSERCH.PCX');
  Copy(CDROMDrive,':\FORMATS\IDXSEL.PCX');
  Copy(CDROMDrive,':\FORMATS\IDX01.PCX');
  Copy(CDROMDrive,':\FORMATS\IDX02.PCX');
  Copy(CDROMDrive,':\FORMATS\IDX03.PCX');
  Copy(CDROMDrive,':\FORMATS\IDX04.PCX');
  Copy(CDROMDrive,':\FORMATS\IDX05.PCX');
  Copy(CDROMDrive,':\FORMATS\IDX06.PCX');
  Copy(CDROMDrive,':\FORMATS\IDX07.PCX');
  Copy(CDROMDrive,':\FORMATS\TOCPOPUP.PCX');
  Copy(CDROMDrive,':\FORMATS\_STARTUP.PCX');
  Copy(CDROMDrive,':\FORMATS\_NEXTS.PCX');
  Copy(CDROMDrive,':\FORMATS\_PREVS.PCX');
  Copy(CDROMDrive,':\FORMATS\DDJ.ICO');
  Copy(CDROMDrive,':\FORMATS\_STARTUP.HWN');
  Copy(CDROMDrive,':\FORMATS\DDJFORM.HWN');
  Copy(CDROMDrive,':\README.TXT');

  {Mssg(5,21,'Creating Program Manager Group...');}
  StrRet := 'Essential Books on File Formats';
  DoFunc(16);
  BranchEq(IntRet,0,Complete);

  StrRet := SysPath;
  DoFunc(6);
  SysPath2 := StrRet;
  Concat(StrRet,'HRW.EXE');
  Concat(StrRet,',','File Formats Books');
  Concat(StrRet,',',SysPath2,'DDJ.ICO');
  DoFunc(17);

{ Routines to Add Read Me File }
  StrRet := SysPath;
  ReadMeFile := SysPath;
  StrRet := '';
  Concat(StrRet,'NOTEPAD.EXE');
  Concat(ReadFile,' ',SysPath,'\','README.TXT');
  Concat(StrRet,ReadFile);
  Concat(StrRet,',','READ ME FILE');
  DoFunc(17);

{ End Routines for Read Me File}

Complete:
  StrRet := InstName;
  DoFunc(0);
  Mssg(0,0,'Installation complete.  For important information, select the READ ME FILE icon.');
  Cls;
  Goto Exit;

Error:
  StrRet := InstName;
  DoFunc(0);
  Mssg(0,0,'An error has occurred during the installation process.');
  Cls;
  Goto Exit;

Leaving:
  StrRet := InstName;
  DoFunc(0);
  Mssg(0,0,'Installation aborted by User');
  Cls;
  Goto Exit;

Exit:
