home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1996 November / VPR9611B.ISO / driver / hp / win31 / copy10v / scanjet.ms_ / scanjet.ms
Text File  |  1994-12-19  |  45KB  |  1,568 lines

  1. '**************************************************************************
  2. '*                    HP ScanJet/DeskScan II v2.1 Setup
  3. '*
  4. '* (c) Copyright Hewlett-Packard Company, 1991-1994.
  5. '* All rights are reserved. Copying or other reproduction of
  6. '* this program except for archival purposes is prohibited
  7. '* without the prior written consent of Hewlett-Packard Company.
  8. '*
  9. '*                   RESTRICTED RIGHTS LEGEND
  10. '*
  11. '* Use, duplication, or disclosure by the Government is subject to 
  12. '* restrictions as set forth in paragraph (b) (3) (B) of the Rights 
  13. '* in Technical Data and Computer Software clause in DAR 7-104.9(a).
  14. '*
  15. '* HEWLETT-PACKARD COMPANY
  16. '* Greeley, Colorado
  17. '*
  18. '**************************************************************************
  19.  
  20.  
  21. ''$DEFINE DEBUG                      '' Define for script development/debugging
  22.  
  23. '$INCLUDE 'setupapi.inc'
  24. '$INCLUDE 'ds2util.inc'
  25. '$INCLUDE 'msdetect.inc'
  26.  
  27.  
  28. '' ********** CONSTANTS **********
  29.  
  30. '' ***** Bitmap ID from DIALOGS.RC *****
  31.  
  32. CONST LOGO                             = 1
  33.  
  34. '' ***** Dialog ID's *****
  35.  
  36. CONST WELCOME                        = 100
  37. CONST ASKQUIT                        = 200
  38. CONST DESTPATH                        = 300
  39. CONST EXITFAILURE                    = 400
  40. CONST EXITQUIT                        = 600
  41. CONST EXITSUCCESS                    = 700
  42. CONST OPTIONS                        = 800
  43. CONST APPHELP                        = 900
  44. CONST APPHELP1                        = 901
  45. CONST APPHELP2                        = 902
  46. CONST APPHELP3                        = 903
  47. CONST APPHELP4                        = 904
  48. CONST APPHELP5                        = 905
  49. CONST APPHELP6                        = 906
  50. CONST LICENSE                        = 907
  51.  
  52. CONST MODIFYCONFIG                = 1010
  53. CONST MODIFYSYSTEMINI            = 1020
  54. CONST INSERTREF                    = 1050
  55. CONST REMOVEHIPERF                = 1060
  56. CONST HIPERFNAMES                    = 1070
  57. CONST MODIFYIICSYSTEMINI        = 1080
  58.  
  59. CONST GROUPLIST                    = 2000
  60. CONST CARDOPTIONS                    = 2010
  61. CONST ERRORSPACE                    = 2030
  62.  
  63. CONST CHECK                            = 2500
  64.  
  65. CONST CUSTINST                        = 6200
  66. CONST BADPATH                        = 6400
  67.  
  68. CONST CDCONFIRMINFO                = 7300
  69.  
  70. CONST ERR_WINDOWSVERSION        = 8000
  71. CONST ERR_WINDOWSMODE            = 8001
  72. CONST ERR_CORRUPTSOURCES        = 8002
  73. CONST ERR_DOSVERSION                = 8003
  74.  
  75. CONST STR_OPTIONALSCSICARD        = 8100
  76. CONST STR_DIR                        = 8101
  77. CONST STR_PROGMANGROUP            = 8102
  78. CONST STR_SCANNER                    = 8103
  79. CONST STR_INTERFACECARD            = 8104
  80. CONST STR_SCSIADDRESS            = 8105
  81. CONST STR_SCANNERTEST            = 8106
  82. CONST STR_READMETXT                 = 8107
  83. CONST STR_SJPLUSCARD                = 8108
  84. CONST STR_GROUPSTRING            = 8109
  85. CONST STR_DESKSCAN             = 8110
  86. CONST STR_HPSCREENCALIBRATION = 8111
  87. CONST STR_SETUP                = 8112
  88. CONST STR_TITLE                = 8113
  89. CONST STR_HPINTERFACECARD      = 8114
  90. CONST STR_ABOUT1               = 8115
  91. CONST STR_ABOUT2               = 8116
  92. CONST STR_EISA                 = 8117
  93. CONST STR_MCA                  = 8118
  94. CONST STR_ISA                  = 8119
  95. CONST STR_NOTEPADEXE           = 8120
  96. CONST STR_HPDSINI                    = 8121
  97. CONST STR_LICENSETXT             = 8123
  98. CONST STR_DSGROUPSTRING     = 8124
  99.  
  100.  
  101. '' ***** GLOBALS *****
  102.  
  103. GLOBAL ExtraCosts$                '' List of extra costs to add per drive.
  104. GLOBAL DestCost&                    '' Calc'd disk space required to install files
  105. GLOBAL WinCost&                    '' 
  106. GLOBAL DestFree&                    '' Amount of free space on the destination disk
  107. GLOBAL WinFree&                    '' 
  108.  
  109. GLOBAL DriversList$
  110. GLOBAL szDrives$
  111. GLOBAL szDeskScan$
  112.  
  113. GLOBAL ASPIFound%
  114. GLOBAL CAMFound%
  115.  
  116. GLOBAL MajVer%                            '' Major version number (Windows or DOS)
  117. GLOBAL MinVer%                            '' Minor version number (Windows or DOS)
  118. GLOBAL WinMode%
  119.  
  120. GLOBAL WinDir$                            '' Windows directory.
  121. ''GLOBAL TwainDir$                        '' Directory for the TWAIN Data Source.
  122.  
  123. GLOBAL DEST$                            '' Default destination directory.
  124. GLOBAL OptScanner(2) AS STRING    '' Scanner installation option.
  125. GLOBAL ScannerPick$                    '' Text for 'ScannerChoice'.
  126. GLOBAL ScannerChoice%                '' 1 for ScanJet II or 3 family,
  127.                                              '' 2 for ScanJet Plus,
  128. GLOBAL AskModSysIni%                    '' 1 if the SYSTEM.INI file should be mod'd
  129. GLOBAL ConfigFile$
  130.  
  131. GLOBAL OPTSETUP$                        '' Setup type option selection.
  132. GLOBAL OPTCard$                        '' Option to use existing card.
  133. GLOBAL OPTCardText(3) AS STRING    '' Text for selected card option.
  134. GLOBAL DEFAULTGROUP$                    '' Default group name.
  135. GLOBAL GROUP$                            '' Selected group name.
  136. GLOBAL SystemArchitecture$            '' Detected architecture.
  137. GLOBAL LISTMADE%                        '' True if group names list has been
  138.                                             '' made, False otherwise.
  139. GLOBAL DS2Cui$
  140.  
  141. ''GLOBAL MUSTREBOOT%                    '' 1 if CONFIG.SYS or SYSTEM.INI modified.
  142. ''                                            '' 0 if neither file modified.
  143. ''GLOBAL MANUALMOD%                        '' 1 if user must modify SYSTEM.INI or
  144. ''                                            '' CONFIG.SYS.  0 if not needed.
  145.  
  146.  
  147. '' ***** SUBROUTINES *****
  148.  
  149. DECLARE SUB Install
  150. DECLARE SUB MyRemoveFiles
  151. DECLARE SUB CalcCopyCost
  152. DECLARE SUB MakeCopyList
  153. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  154.  
  155.  
  156. ''***************************************************************************
  157. ''***********                 BEGINNING OF SCRIPT                  **********
  158. ''***************************************************************************
  159.  
  160. INIT:
  161.     dim dlg%
  162.     errStr$     = STRING$(256,0)
  163.     Setup$      = STRING$(128,0)
  164.     DS2Cui$     = "ds2cui.dll"        '' Custom UI stuff for DS2
  165. ''    MUSTREBOOT% = 0
  166. ''    MANUALMOD%  = 0
  167.  
  168.  
  169.     i% = AcquireString(STR_SETUP, Setup$, 128)
  170.  
  171.     About1$ = STRING$(256,0)
  172.     i% = AcquireString(STR_ABOUT1, About1$, 256)
  173.  
  174.     About2$ = STRING$(128,0)
  175.     i% = AcquireString(STR_ABOUT2, About2$, 128)
  176.  
  177.     SetAbout About1$, About2$
  178.  
  179.     About1$ = STRING$(0,0)                    '' release string's memory
  180.     About2$ = STRING$(0,0)
  181.     
  182.  
  183.     ''    Verify DOS version:  Must be DOS 5.0 or better...
  184.  
  185.     MajVer% = GetDOSMajorVersion()
  186.     MinVer% = GetDOSMinorVersion()
  187.  
  188.     IF (MajVer% < 5) THEN
  189.         i%   = FAcquireString(ERR_DOSVERSION, errStr$, 256)
  190.         i%   = DoMsgBox(errStr$, Setup$, MB_TASKMODAL+MB_ICONHAND+MB_OK)
  191.         dlg% = EXITFAILURE
  192.         GOTO QUITL1
  193.     END IF
  194.  
  195.  
  196.     ''    Verify Windows version and mode:  Must be Windows 3.1 or better...
  197.  
  198.     MajVer% = GetWindowsMajorVersion()
  199.     MinVer% = GetWindowsMinorVersion()
  200.  
  201.     IF (MajVer% < 3) OR ((MajVer% = 3) AND (MinVer% < 1)) THEN
  202.         i%   = FAcquireString(ERR_WINDOWSVERSION, errStr$, 256)
  203.         i%   = DoMsgBox(errStr$, Setup$, MB_TASKMODAL+MB_ICONHAND+MB_OK)
  204.         dlg% = EXITFAILURE
  205.         GOTO QUITL1
  206.     END IF
  207.  
  208.     WinMode% = GetWindowsMode()
  209.  
  210.     IF WinMode% = 0 THEN
  211.         i%   = AcquireString(ERR_WINDOWSMODE, errStr$, 256)
  212.         i%   = DoMsgBox(errStr$,  Setup$, MB_TASKMODAL+MB_ICONHAND+MB_OK)
  213.         dlg% = EXITFAILURE
  214.         GOTO QUITL1
  215.     END IF
  216.  
  217.  
  218.     ''    Display main window frame maximized.
  219.  
  220.     dim hWnd%
  221.     dim j%
  222.  
  223.     hWnd% = HwndFrame()
  224.     j%    = MoveWindow(hWnd%, 0, 0, GetScreenWidth(), GetScreenHeight(), 0) 
  225.  
  226.  
  227.     ''    Create place holders for setup information that will be displayed
  228.     ''    in a "ConfirmInfo" dialog.  One "AddListItem" is needed for each
  229.     ''    piece of data that will be displayed.  The NULLs will be replaced
  230.     ''    based on information entered by the user.
  231.  
  232.     AddListItem "ConfirmTextIn", ""
  233.     AddListItem "ConfirmTextIn", ""
  234.     AddListItem "ConfirmTextIn", ""
  235.     AddListItem "ConfirmTextIn", ""
  236.     AddListItem "ConfirmTextIn", ""
  237.     AddListItem "ConfirmTextIn", ""
  238.  
  239.  
  240.     '' Initialize a bunch of variables and strings and stuff...
  241.  
  242. ''    OptScanner(0)  = "ScanJet IIp, IIc, IIcx, 3p, 3c "
  243.     OptScanner(0)  = "ScanJet IIp, IIc, IIcx, 3p "
  244.     OptScanner(1)  = "ScanJet Plus "
  245.     ScannerChoice% = 1                '' ScanJet II or 3 family
  246.     ScannerPick$   = OptScanner(ScannerChoice% - 1)
  247.     
  248.     DriversList$        = "SJDrivers"
  249.     SystemArchitecture$ = "ISA"
  250.     SetSymbolValue "SystemArchitecture", SystemArchitecture$
  251.  
  252.     AddListItem DriversList$, "SJDRIVER.SYS"    
  253.     AddListItem DriversList$, "MINI400I.SYS"    
  254.     AddListItem DriversList$, "SJIIX.SYS"    
  255.     AddListItem DriversList$, "SJII.SYS"
  256.  
  257.     SetSymbolValue "SJIIDriverFound",    "0"    '' "1" if HP SCSI card found
  258.     SetSymbolValue "RemingtonCardFound", "0"    '' "1" if Remington is found
  259.     SetSymbolValue "WIN31VxD",           "WIN400I.386"
  260.     SetSymbolValue "ScannerVxD",         "HPSCANR.386"
  261.     SetSymbolValue "InstalledCard",      "0"
  262.     
  263.     WinDir$ = GetWindowsDir()
  264.  
  265.     SetSymbolValue "ConfigTemp",    "C:\CONFIG.TMP"    
  266.     SetSymbolValue "AutoexecTemp",  "C:\AUTOEXEC.TMP"
  267.     SetSymbolValue "SysIniTemp",    WinDir$+"SYSTEM.TMP"    
  268.     SetSymbolValue "SysIniThrowAwayFile", WinDir$+"SYSTEM.HP~"
  269.     
  270.     SetSymbolValue "ConfigBackup",  "C:\CONFIG.HP"    
  271.     SetSymbolValue "AutoexecBackup","C:\AUTOEXEC.HP"    
  272.     SetSymbolValue "SysIniBackup",  WinDir$+"SYSTEM.HP"    
  273.  
  274.     HELPPROC$  = "FHelpDlgProc"    '' Define Help procedures
  275.     HELP1PROC$ = "FHelp1DlgProc"
  276.     HELP2PROC$ = "FHelp2DlgProc"
  277.     HELP3PROC$ = "FHelp3DlgProc"
  278.     HELP4PROC$ = "FHelp4DlgProc"
  279.     HELP5PROC$ = "FHelp5DlgProc"
  280.     HELP6PROC$ = "FHelp6DlgProc"
  281.  
  282.  
  283.     '' Set up the background bitmap and the window title...
  284.  
  285.     SetBitmap DS2Cui$, LOGO
  286.     Title$ = STRING$(64,0)
  287.     i%     = AcquireString(STR_TITLE, Title$, 64)
  288.     SetTitle Title$
  289.     Title$ = STRING$(0,0)
  290.  
  291.  
  292.     ''    Handle the .INF file...
  293.  
  294.     szInf$ = STRING$(144,0)
  295.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  296.  
  297.     IF szInf$ = "" THEN                '' Get the PATH for the .INF file...
  298.         szInf$ = GetSymbolValue("STF_CWDDIR") + "SCANJET.INF"
  299.     END IF
  300.  
  301.     ReadInfFile szInf$                '' Read the .INF file..
  302.     szInf$ = STRING$(0,0)
  303.  
  304.  
  305.  
  306.     '' Some more initialization stuff...
  307.     LISTMADE% = 0
  308.     OPTSETUP$ = "1"
  309.     OPTCard$  = "1"                    '' HP SCSI card (Remington or Fred)
  310.     SetSymbolValue "OPTCard", OPTCard$
  311.  
  312.     '' Initialize the Interface Card Name String array...
  313.  
  314.     cardStr$       = STRING$(256,0)
  315.     i% = AcquireString(STR_HPINTERFACECARD, cardStr$, 256)
  316.     OPTCardText(0) = cardStr$
  317.     i% = AcquireString(STR_OPTIONALSCSICARD, cardStr$, 256)
  318.     OPTCardText(1) = cardStr$
  319.     i% = AcquireString(STR_SJPLUSCARD, cardStr$, 256)
  320.     OPTCardText(2) = cardStr$
  321.     cardStr$       = STRING$(0,0)
  322.  
  323.     ASPIFound% = 0
  324.  
  325.     groupStr$     = STRING$(64,0)
  326.  
  327.     szDrives$ = STRING$(128,0)
  328.     szDeskScan$ = STRING$(128,0)
  329.  
  330.     szDrives$ = "LocalDrives"
  331.     SetSymbolValue szDrives$, ""
  332.     GetLocalHardDrivesList szDrives$
  333.     NumberOfDrives% = GetListLength( szDrives$ )
  334.  
  335.     FOR j%= 1 TO NumberOfDrives%
  336.         szDeskScan$ = FindFileInTree( "DESKSCAN.EXE", GetListItem( szDrives$, j% )+":\" )
  337.         
  338.         IF LEN(szDeskScan$) > 10 THEN
  339.             DEST$  = MID$( szDeskScan$, 1, LEN(szDeskScan$) - 13 )
  340.             i% = AcquireString(STR_DSGROUPSTRING, groupStr$, 64)
  341.             GOTO DEFAULTDIRDONE
  342.         END IF
  343.     NEXT
  344.  
  345.     DEST$  = "C:\HPCOPY"    
  346.     i%            = AcquireString(STR_GROUPSTRING, groupStr$, 64)
  347.  
  348. DEFAULTDIRDONE:
  349.     DEFAULTGROUP$ = groupStr$
  350.     GROUP$        = DEFAULTGROUP$
  351.     groupStr$     = STRING$(0,0)
  352.     szDrives$     = STRING$(0,0)
  353.     szDeskScan$   = STRING$(0,0)
  354.     
  355.  
  356. ''    DEST$     = "C:\DESKSCAN"
  357. ''    TwainDir$ = WinDir$ + "TWAIN\"  
  358.     SetSymbolValue "InstallDir", DEST$
  359. ''    SetSymbolValue "TwainDir",   TwainDir$
  360.  
  361.     AddListItem "SettingsTextIn", DEST$
  362.     AddListItem "SettingsTextIn", GROUP$
  363.     AddListItem "SettingsTextIn", OPTCardText(0)
  364.     AddListItem "SettingsTextIn", OptScanner(0)
  365.  
  366.     AddListItem "DiskSpaceData", MID$(DEST$, 1, 2)
  367.     AddListItem "DiskSpaceData", ""
  368.     AddListItem "DiskSpaceData", ""
  369.     AddListItem "DiskSpaceData", MID$(WinDir$, 1, 2)
  370.     AddListItem "DiskSpaceData", ""
  371.     AddListItem "DiskSpaceData", ""
  372.  
  373.     DestCost& = 0
  374.     WinCost&  = 0
  375.     DestFree& = 0
  376.     WinFree&  = 0
  377.  
  378.  
  379.  
  380. WELCOME:
  381.     '' **********************
  382.     '' *** Welcome dialog ***
  383.     '' **********************
  384.     dim sz$                                '' dynamic-length string
  385.     sz$ = UIStartDlg(DS2Cui$, WELCOME, "FInfoDlgProc", APPHELP6, HELP6PROC$)
  386.  
  387.     IF sz$ = "CONTINUE" THEN        '' Pressed the "Continue" button
  388.         UIPop 1
  389.  
  390.     ELSEIF sz$ = "REACTIVATE" THEN
  391.         GOTO WELCOME
  392.  
  393.     ELSE                                    '' Pressed the "Exit" button
  394. ''        UIPop 1
  395.         GOSUB ASKQUIT
  396.         GOTO WELCOME
  397.     END IF
  398.  
  399.  
  400. LICENSE:
  401.     '' **********************
  402.     '' *** License dialog ***
  403.     '' **********************
  404.     sz$ = UIStartDlg(DS2Cui$, LICENSE, "FInfoDlgProc", APPHELP6, HELP6PROC$)
  405.  
  406.     IF sz$ = "CONTINUE" THEN        '' Pressed the "Continue" button
  407.         UIPop 1
  408.  
  409.     ELSEIF sz$ = "READ" THEN        '' Pressed the "Read" Button
  410.         LicenseTxtStr$ = STRING$(16,0)
  411.         i% = AcquireString(STR_LICENSETXT, LicenseTxtStr$, 16)
  412.  
  413.         NotePadExeStr$ = STRING$(16,0)
  414.         i% = AcquireString(STR_NOTEPADEXE, NotePadExeStr$, 16)
  415.  
  416.         SrcDir$ = GetSymbolValue("STF_SRCDIR")    '' Get our SOURCE directory
  417.  
  418. ''i% = DoMsgBox( NotePadExeStr$+" "+MakePath(SrcDir$, LicenseTxtStr$), "TESTING", 0 )
  419.         RUN NotePadExeStr$+" "+MakePath(SrcDir$, LicenseTxtStr$)
  420.  
  421.         NotePadExeStr$ = STRING$(0,0)
  422.         LicenseTxtStr$ = STRING$(0,0)
  423.         errStr$       = STRING$(0,0)
  424.     
  425.         GOTO LICENSE
  426.  
  427.     ELSEIF sz$ = "REACTIVATE" THEN
  428.         GOTO LICENSE
  429.  
  430.     ELSE                                    '' Pressed the "Exit" button
  431.         UIPop 1
  432.         GOSUB ASKQUIT
  433.         GOTO LICENSE
  434.     END IF
  435.  
  436.  
  437.  
  438.     IF IsItEISA = 1 THEN                ''    Get information about the system.
  439.         SystemArchitecture$ = "EISA"
  440.         EISAStr$ = STRING$(128,0)
  441.         i% = AcquireString(STR_EISA, EISAStr$, 128)
  442.         SetSymbolValue "SystemArchitecture", EISAStr$
  443.         EISAStr$ = STRING$(0,0)
  444.  
  445.     ELSEIF IsItMCA = 2 THEN
  446.         SystemArchitecture$ = "MCA"
  447.         MCAStr$ = STRING$(128,0)
  448.         i% = AcquireString(STR_MCA, MCAStr$, 128)
  449.         SetSymbolValue "SystemArchitecture", MCAStr$
  450.         MCAStr$ = STRING$(0,0)
  451.  
  452.     ELSE
  453.         SystemArchitecture$ = "ISA"
  454.         ISAStr$ = STRING$(128,0)
  455.         i% = AcquireString(STR_ISA, ISAStr$, 128)
  456.         SetSymbolValue "SystemArchitecture", ISAStr$
  457.         ISAStr$ = STRING$(0,0)
  458.     END IF
  459.  
  460.  
  461.     ASPIFound% = FindASPI
  462.     CAMFound%  = FindCAM
  463.  
  464.  
  465.  
  466.  
  467. CHOOSESCANNER:        '' Select which scanner(s) is/are being installed.
  468.     ScannerPick$ = ""
  469.     ScannerChoice% = 0
  470.  
  471. CHOOSESCANNERL1:    '' Is the scanner a ScanJet Plus or ScanJet II/3 family?
  472.     '' ********************************
  473.     '' *** Scanner Selection dialog ***
  474.     '' ********************************
  475.     sz$ = UIStartDlg(DS2Cui$, OPTIONS, "FRadioDlgProc", APPHELP1, HELP1PROC$)
  476.     szChoice$ = GetSymbolValue("ButtonChecked")
  477.  
  478.  
  479.     IF (szChoice$ = "1") THEN
  480.         ScannerChoice% = 1            '' ScanJet II or 3 family Scanner
  481.         IF (FCheckForRemington() <> 0) THEN
  482.             SetSymbolValue "RemingtonCardFound", "1"
  483.             SetSymbolValue "InstalledCard", "3"
  484.         ELSE
  485.             SetSymbolValue "InstalledCard", "4"
  486.         ENDIF
  487.         '' We decide in the ds2cui.c:ModifyConfig() routine whether the 
  488.         '' interface card is a Remington or Fred card and (i would think)
  489.         '' set OPTCard$ accordingly (though I haven't found the code that
  490.         '' does it yet--klb 940607).
  491.  
  492.     ELSE
  493.         OPTCard$       = "3"            '' ScanJet Plus Card
  494.         ScannerChoice% = 2            '' ScanJet Plus Scanner
  495.         SetSymbolValue "InstalledCard", "1"
  496.         SetSymbolValue "OPTCard", OPTCard$
  497.         ReplaceListItem "SettingsTextIn", 3, OPTCardText(2)
  498.         ReplaceListItem "SettingsTextIn", 4, OptScanner(ScannerChoice% - 1)
  499.     END IF
  500.  
  501.     ScannerPick$ = OptScanner(ScannerChoice% - 1)
  502.  
  503.     IF sz$ = "CONTINUE" THEN        '' Pressed the "Continue" button
  504.         UIPop 1
  505.         MakeCopyList                    '' Build the default file copy list
  506.         CalcCopyCost                    ''    Compute req'd disk space
  507.         GOTO OPTION
  508.     
  509.     ELSEIF sz$ = "REACTIVATE" THEN
  510.         GOTO CHOOSESCANNERL1
  511.  
  512.     ELSE                                    '' Pressed the "Exit" button
  513.          GOSUB ASKQUIT
  514.         GOTO CHOOSESCANNER
  515.     END IF
  516.  
  517.  
  518.  
  519. OPTION:            ''    Installation Settings confirmation dialog
  520.                     
  521. OPTL1:
  522.     '' ************************************
  523.     '' *** Installation Settings dialog *** 
  524.     '' ************************************
  525.     sz$ = UIStartDlg(DS2Cui$, CUSTINST, "FCustomOptDlgProc", APPHELP2, HELP2PROC$)
  526.  
  527.     OPTSETUP$ = GetSymbolValue("ButtonChecked")
  528.     UIPop 1    
  529.  
  530.     IF sz$ = "CONTINUE" THEN            '' Pressed the 'Continue' button
  531.         OPTSETUP$ = "1"
  532.  
  533.     ELSEIF sz$ = "REACTIVATE" THEN
  534.         GOTO OPTL1
  535.  
  536.     ELSEIF sz$ = "CUSTOM" THEN            '' Pressed the 'Modify' button
  537.         OPTSETUP$ = "2"
  538.  
  539.     ELSE                                        '' Pressed the 'Exit' button
  540.         UIPop 1
  541.          GOSUB ASKQUIT
  542.         GOTO OPTION
  543.     END IF
  544.  
  545.  
  546. CHECKDISKSPACE:    '' for the quick path, we still need to check disk space
  547.  
  548.     IF (OPTSETUP$ = "1") THEN
  549.         IF DestFree& < DestCost& THEN
  550.             '' **************************************
  551.             '' *** Insufficient Disk Space Dialog ***
  552.             '' **************************************
  553.             sz$ = UIStartDlg(DS2Cui$, ERRORSPACE, "FDiskErrorDlgProc", 0, "")
  554.  
  555.             IF sz$ = "EXIT" THEN            '' Pressed the "Exit" button
  556.                 GOSUB ASKQUIT
  557.                 GOTO CHECKDISKSPACE
  558.  
  559.             ELSEIF sz$ = "REACTIVATE" THEN
  560.                 GOTO CHECKDISKSPACE
  561.  
  562.             ELSE                                '' Pressed the "OK" button
  563.                  UIPop 2
  564.                 GOTO GETPATH
  565.             END IF
  566.  
  567.         ELSE
  568.             UIPop 1
  569.         END IF
  570.  
  571.         GOTO STARTINSTALL
  572.     END IF
  573.  
  574.  
  575.  
  576. GETPATH:
  577.     SetSymbolValue "EditTextIn", DEST$
  578.     SetSymbolValue "EditFocus", "END"
  579.  
  580. GETPATHL1:
  581.     '' ***********************************************
  582.     '' *** Installation Directory Selection dialog ***
  583.     '' ***********************************************
  584.     sz$   = UIStartDlg(DS2Cui$, DESTPATH, "FEditDlgProc", APPHELP3, HELP3PROC$)
  585.     DEST$ = LTRIM$(RTRIM$(GetSymbolValue("EditTextOut")))
  586.  
  587.     SetSymbolValue "InstallDir", DEST$
  588.  
  589.     IF sz$ = "CONTINUE" THEN
  590.         IF IsDirWritable(DEST$) = 0 THEN
  591.             GOSUB BADPATH
  592.             GOTO GETPATHL1
  593.         END IF
  594.         MakeCopyList                    '' disk or directory may have changed
  595.         CalcCopyCost                    '' target disk may have changed
  596.         GOTO TESTSPACE
  597.  
  598.     ELSEIF sz$ = "REACTIVATE" THEN
  599.         GOTO GETPATHL1
  600.  
  601.     ELSEIF sz$ = "BACK" THEN
  602.         UIPop 1
  603.         GOTO OPTION
  604.  
  605.     ELSE
  606.         UIPop 1
  607.         GOSUB ASKQUIT
  608.         GOTO GETPATH
  609.     END IF
  610.  
  611.     
  612.  
  613.  
  614. TESTSPACE:
  615.     IF (DestFree& < DestCost&) THEN
  616.         '' **************************************
  617.         '' *** Insufficient Disk Space Dialog ***
  618.         '' **************************************
  619.         sz$ = UIStartDlg(DS2Cui$, ERRORSPACE, "FDiskErrorDlgProc", 0, "")
  620.  
  621.         IF sz$ = "EXIT" THEN            '' Pressed the "Exit" button
  622.             GOSUB ASKQUIT
  623.             GOTO TESTSPACE
  624.  
  625.         ELSEIF sz$ = "REACTIVATE" THEN
  626.             GOTO TESTSPACE
  627.  
  628.         ELSE                                '' Pressed the "OK" button
  629.              UIPop 2
  630.             GOTO GETPATH
  631.         END IF
  632.  
  633.     ELSE
  634.         UIPop 1                            '' is this needed?  klb 940615
  635.     END IF
  636.  
  637.     '' If express setup and did the destination because of a disk space 
  638.     '' problem, then we need to go do the installation.
  639.  
  640.     IF OPTSETUP$ = "1" THEN
  641.         GOTO STARTINSTALL
  642.     END IF
  643.  
  644.  
  645.  
  646. GETGROUPNAME:
  647.     IF LISTMADE% = 0 THEN
  648.         AddListItem "ListGroupsIn", DEFAULTGROUP$
  649.         LISTMADE% = 1
  650.     END IF
  651.  
  652.     SetSymbolValue "ListGroupsOut", DEFAULTGROUP$
  653.  
  654. GETGROUPNAMEL1:
  655.     '' *******************************************
  656.     '' *** Select Program Manager Group dialog ***
  657.     '' *******************************************
  658.     sz$    = UIStartDlg(DS2Cui$, GROUPLIST, "FGroupsDlgProc", APPHELP4, HELP4PROC$)
  659.  
  660.     GROUP$ = GetSymbolValue("EditGroupOut")
  661.  
  662.     IF sz$ = "CONTINUE" THEN
  663.         UIPop 1
  664.         GOTO CARDOPTION
  665.  
  666.     ELSEIF sz$ = "REACTIVATE" THEN
  667.         GOTO GETGROUPNAMEL1
  668.  
  669.     ELSEIF sz$ = "BACK" THEN
  670.         UIPop 1
  671.         GOTO GETPATH
  672.  
  673.     ELSE
  674.         UIPop 1
  675.         GOSUB ASKQUIT
  676.         GOTO GETGROUPNAME
  677.     END IF
  678.  
  679.  
  680.  
  681. CARDOPTION:
  682.     IF (ScannerChoice% = 2) THEN            '' ScanJet Plus == 2
  683.         OPTCard$ = "3"                            '' ScanJet Plus interface card
  684.         SetSymbolValue "InstalledCard", "1"
  685.         SetSymbolValue "OPTCard", OPTCard$
  686.         SetSymbolValue "RemingtonCardFound", "0"
  687.         GOTO CONFIRMINFO                        '' already know the card so skip the dlg
  688.     END IF
  689.  
  690.     SetSymbolValue "RadioDefault", OPTCard$
  691.  
  692. CARDOPTIONL1:                 
  693.     '' *********************************************
  694.     '' *** Scanner Interface Card Options dialog ***
  695.     '' *********************************************
  696.     sz$ = UIStartDlg(DS2Cui$, CARDOPTIONS, "FCardOptDlgProc", APPHELP5, HELP5PROC$)
  697.  
  698.    OPTCard$ = GetSymbolValue("ButtonChecked")
  699.  
  700.     SetSymbolValue "OPTCard", OPTCard$
  701.  
  702.     IF sz$ = "CONTINUE" THEN
  703.         UIPop 1
  704.         IF OPTCard$ = "1" THEN
  705.             IF (FCheckForRemington() <> 0) THEN
  706.                 SetSymbolValue "InstalledCard", "3"
  707.                 SetSymbolValue "RemingtonCardFound", "1"
  708.             ELSE
  709.                 SetSymbolValue "InstalledCard", "4"
  710.             ENDIF
  711.  
  712.         ELSEIF OPTCard$ = "2" THEN
  713.             SetSymbolValue "InstalledCard", "0"
  714.             SetSymbolValue "RemingtonCardFound", "0"
  715.         END IF
  716.         GOTO CONFIRMINFO
  717.  
  718.     ELSEIF sz$ = "REACTIVATE" THEN
  719.         GOTO CARDOPTIONL1
  720.  
  721.     ELSEIF sz$ = "BACK" THEN
  722.         UIPop 1
  723.         GOTO GETGROUPNAME
  724.  
  725.     ELSE
  726.         UIPop 1
  727.          GOSUB ASKQUIT
  728.         GOTO CARDOPTION
  729.     END IF
  730.  
  731.  
  732.  
  733. CONFIRMINFO:
  734.     genericStr$ = STRING$(64,0)
  735.     i% = AcquireString(STR_DIR, genericStr$, 64)
  736.     ReplaceListItem "ConfirmTextIn", 1, genericStr$+":  "+DEST$
  737.  
  738.     i% = AcquireString(STR_PROGMANGROUP, genericStr$, 64)
  739.     ReplaceListItem "ConfirmTextIn", 2, genericStr$+":  "+GROUP$
  740.  
  741.     i% = AcquireString(STR_SCANNER, genericStr$, 64)
  742.     ReplaceListItem "ConfirmTextIn", 3, genericStr$+":   "+ScannerPick$
  743.  
  744.     i% = AcquireString(STR_INTERFACECARD, genericStr$, 64)
  745.     IF OPTCard = "1" THEN
  746.         ReplaceListItem "ConfirmTextIn", 4, genericStr$+":   "+OPTCardText(0)
  747.  
  748.     ELSEIF OPTCard = "2" THEN    
  749.         ReplaceListItem "ConfirmTextIn", 4, genericStr$+":   "+OPTCardText(1)
  750.  
  751.     ELSEIF OPTCard = "3" THEN
  752.         ReplaceListItem "ConfirmTextIn", 4, genericStr$+":   "+OPTCardText(2)
  753.  
  754.     ELSE
  755.         ReplaceListItem "ConfirmTextIn", 4, genericStr$+":   "+OPTCardText(0)
  756.     END IF
  757.  
  758.     genericStr$ = STRING$(0,0)
  759.  
  760.  
  761.     '' *******************************
  762.     '' *** Verify Settings dialogs ***
  763.     '' *******************************
  764.     sz$ = UIStartDlg(DS2Cui$, CDCONFIRMINFO, "FConfirmDlgProc", 0, "")
  765.  
  766.     IF sz$ = "CONTINUE" THEN
  767.         UIPop 1
  768.         GOTO STARTINSTALL
  769.  
  770.     ELSEIF sz$ = "REACTIVATE" THEN
  771.         GOTO CONFIRMINFO
  772.  
  773.     ELSEIF sz$ = "BACK" THEN
  774.         UIPop 1
  775.         GOTO GETPATH
  776.     END IF
  777.  
  778.  
  779.  
  780. STARTINSTALL:        ''    Begin installation
  781.     Install            '' Call the installation control subroutine
  782.  
  783.  
  784.  
  785. QUIT:
  786.     ON ERROR GOTO ERRQUIT
  787.     dlg% = 0
  788.     
  789.     IF ERR = 0 THEN
  790. ''        IF AskModSysIni% = 0 THEN
  791. ''            dlg% = EXITSUCCESS1        '' Don't tell them to reboot
  792. ''        ELSE
  793.             dlg% = EXITSUCCESS        '' Tell them to reboot
  794. ''        END IF            
  795.  
  796.     ELSEIF ERR = STFQUIT THEN
  797.         dlg% = EXITQUIT
  798.  
  799.     ELSE
  800.         dlg% = EXITFAILURE
  801.     END IF
  802.  
  803. QUITL1:
  804.     '' *********************************************************************
  805.     '' The dialog that's displayed depends on the value of dlg% set in QUIT:
  806.     '' *********************************************************************
  807.     sz$ = UIStartDlg(DS2Cui$, dlg%, "FInfo0DlgProc", 0, "")
  808.  
  809.     IF sz$ = "REACTIVATE" THEN
  810.         GOTO QUITL1
  811.     END IF
  812.  
  813.     UIPop 1
  814.  
  815.  
  816.  
  817. ALL_DONE:                                '' Check whether README.TXT got copied.
  818.                                             '' If not, don't bother trying to show it.
  819.     ReadmeTxtStr$ = STRING$(16,0)
  820.     i% = AcquireString(STR_READMETXT, ReadmeTxtStr$, 16)
  821.     i% = DoesFileExist(MakePath(DEST$, ReadmeTxtStr$), femExists)
  822.  
  823.     IF i% = 1 THEN 
  824.         NotePadExeStr$ = STRING$(16,0)
  825.         i% = AcquireString(STR_NOTEPADEXE, NotePadExeStr$, 16)
  826.         RUN NotePadExeStr$+" "+MakePath(DEST$, ReadmeTxtStr$), NOWAIT
  827.         NotePadExeStr$ = STRING$(0,0)
  828.     END IF
  829.  
  830.     ReadmeTxtStr$ = STRING$(0,0)
  831.     errStr$       = STRING$(0,0)
  832.  
  833.     MyRemoveFiles                        '' Delete installer files not used by Bamm-Bamm.
  834.  
  835.      END                                    '' This is an exit point for the script.
  836.  
  837.  
  838.  
  839. ERRQUIT:
  840.     i% = AcquireString(ERR_CORRUPTSOURCES, errStr$, 256)
  841.     i% = DoMsgBox(errStr$, Setup$, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  842.  
  843.     errStr$ = STRING$(0,0)
  844.  
  845.     MyRemoveFiles                        '' Delete installer files not used by Bamm-Bamm.
  846.  
  847.     END                                    '' This is an exit point for the script.
  848.  
  849.  
  850.  
  851. BADPATH:
  852.     '' **********************************************
  853.     '' *** Unknown Path or Directory Error dialog ***
  854.     '' **********************************************
  855.     sz$ = UIStartDlg(DS2Cui$, BADPATH, "FInfo0DlgProc", 0, "")
  856.  
  857.     IF sz$ = "REACTIVATE" THEN
  858.         GOTO BADPATH
  859.  
  860.     ELSE
  861.         UIPop 1                            '' Only one button--Pop the error alert
  862.     END IF
  863.  
  864.     RETURN
  865.  
  866.  
  867.  
  868. ASKQUIT:
  869.     '' *******************************
  870.     '' *** Incomplete Setup dialog ***
  871.     '' *******************************
  872.     sz$ = UIStartDlg(DS2Cui$, ASKQUIT, "FQuitDlgProc", 0, "")
  873.  
  874.     IF sz$ = "EXIT" THEN                '' Pressed the "Quit" button
  875.         UIPopAll
  876.         ERROR STFQUIT
  877.  
  878.     ELSEIF sz$ = "REACTIVATE" THEN
  879.         GOTO ASKQUIT
  880.  
  881.     ELSE
  882.         UIPop 1                            '' Pressed the "Back" button--Pop the error alert
  883.     END IF
  884.  
  885.     RETURN
  886.  
  887. '' ****************************************
  888. '' ********** END OF MAIN SCRIPT **********
  889. '' ****************************************
  890.  
  891.  
  892.  
  893. '*************************************************************************
  894. '** Subroutine: CalcCopyCost
  895. '** Purpose:    Computes the amount of disk space needed to copy the files
  896. '**             the files in the copy list.
  897. '** Arguments:     none.
  898. '** Returns:     none.
  899. '*************************************************************************
  900. SUB CalcCopyCost STATIC
  901.  
  902.     '' How much disk space will we need to copy all these files?
  903.  
  904.     CostPerDisk$ = "CostPerDisk"
  905.     StillNeed&   = GetCopyListCost(ExtraCosts$, CostPerDisk$,"")
  906. ''    DestCost&    = 1536000                '' 1.5 MB required to install Bamm-Bamm
  907.     DestCost&    = 0
  908.     WinCost&     = 0
  909.     cost&        = 0
  910.  
  911.     FOR i% = 1 to 26 STEP 1
  912.         cost& = VAL(GetListItem(CostPerDisk$, i%))
  913.  
  914. '$IFDEF DEBUG
  915. ''    k% = DoMsgBox("drive ("+CHR$(i% + ASC("A")-1)+") cost ("+str$(cost&)+").", "Copy Costs", MB_TASKMODAL+MB_OK+MB_ICONINFORMATION)
  916. '$ENDIF
  917.  
  918.     NEXT i%
  919.  
  920.     DestDrive$ = MID$(DEST$, 1, 1)
  921.     i%         = ASC(ucase$(DestDrive$)) - ASC("A") + 1
  922.     DestCost&  = VAL(GetListItem(CostPerDisk$, i%))
  923.  
  924.     ReplaceListItem "DiskSpaceData", 1, " " + DestDrive$ + ":"
  925.     ReplaceListItem "DiskSpaceData", 2, STR$(DestCost& / 1024) + " K"
  926.     drive$    = MID$(DEST$, 1, 1)
  927.     DestFree& = GetFreeSpaceForDrive(drive$)
  928.  
  929.     IF (DestFree& < 0) THEN
  930.         DestFree& = 0
  931.     END IF
  932.  
  933.     ReplaceListItem "DiskSpaceData", 3, STR$(DestFree& / 1024) + " K"
  934.  
  935.     WinDrive$ = MID$(WinDir$, 1, 1)
  936.     ndrive%   = ASC(ucase$(WinDrive$)) - ASC("A") + 1
  937.     WinCost&  = VAL(GetListItem(CostPerDisk$, ndrive%))
  938.  
  939. '$IFDEF DEBUG
  940. ''    i% = DoMsgBox("Windows drive ('"+str$(ndrive%)+"') index in list.", "Copy Costs", MB_TASKMODAL+MB_OK+MB_ICONINFORMATION)
  941. '$ENDIF
  942.  
  943.     ReplaceListItem "DiskSpaceData", 5, STR$(WinCost& / 1024) + " K"
  944.  
  945.     WinFree& = GetFreeSpaceForDrive(WinDrive$)
  946.  
  947.     IF (WinFree& < 0) THEN
  948.         WinFree& = 0
  949.     END IF
  950.  
  951.     ReplaceListItem "DiskSpaceData", 6, STR$(WinFree& / 1024) + " K"
  952.  
  953.     CostPerDisk$ = ""
  954.  
  955. END SUB
  956.  
  957.  
  958.  
  959. '*************************************************************************
  960. '** Subroutine: MakeCopyList
  961. '** Purpose:    Builds the copy list.
  962. '** Arguments:     none.
  963. '** Returns:     none.
  964. '*************************************************************************
  965. SUB MakeCopyList STATIC
  966.  
  967.     ClearCopyList                                    '' Start with a clean copy list
  968.  
  969.     SrcDir$ = GetSymbolValue("STF_SRCDIR")    '' Get our SOURCE directory
  970.  
  971.     '' Add all the files to the copy list that we copy in all cases...
  972.  
  973. ''$IFDEF 1
  974. ''    AddSectionFilesToCopyList "Setup Files",        SrcDir$, DEST$
  975.     AddSectionFilesToCopyList "Files",              SrcDir$, DEST$
  976.     AddSectionFilesToCopyList "Utility Files",      SrcDir$, DEST$
  977. ''    AddSectionFilesToCopyList "Windows",            SrcDir$, WinDir$
  978. ''    AddSectionFilesToCopyList "Windows:System",     SrcDir$, WinDir$+"SYSTEM\"
  979. ''    AddSectionFilesToCopyList "Windows:TWAIN",      SrcDir$, TwainDir$
  980. ''$ENDIF
  981.  
  982.     '' Here's how to check for NT -- IF (IsItNT()) THEN ...
  983.     '' Where should we put files on an NT system?
  984.     '' How can we keep from installing DOS and Windows drivers on an NT system?
  985.     '' Do any dialogs need to change for installation on an NT system?
  986.     ''    AddSectionFilesToCopyList "NT Files", SrcDir$, DEST$
  987.  
  988.     '' Add files that are specific to EISA or MCA backplane computers...
  989.  
  990.     IF SystemArchitecture$ = "EISA" THEN
  991.  
  992.         IF ScannerChoice% = 1 THEN    '' ScanJet II or 3 family scanner...
  993.             IF GetSymbolValue("RemingtonCardFound") = "1" THEN
  994.                 AddSectionFilesToCopyList "Remington Card EISA", SrcDir$, DEST$
  995.             ELSE
  996.                 AddSectionFilesToCopyList "Fred Card EISA", SrcDir$, DEST$
  997.             ENDIF
  998.  
  999.         ELSEIF ScannerChoice% = 2 THEN
  1000.             AddSectionFilesToCopyList "ScanJet Plus EISA", SrcDir$, DEST$
  1001.         END IF
  1002.  
  1003.     ELSEIF SystemArchitecture$ = "MCA" THEN
  1004.  
  1005.         IF ScannerChoice% = 1 THEN    '' ScanJet II or 3 family scanner...
  1006.             IF GetSymbolValue("RemingtonCardFound") = "1" THEN
  1007.                 AddSectionFilesToCopyList "Remington Card MCA", SrcDir$, DEST$
  1008.             ELSE
  1009.                 AddSectionFilesToCopyList "Fred Card MCA", SrcDir$, DEST$
  1010.             ENDIF
  1011.  
  1012.         ELSEIF ScannerChoice% = 2 THEN
  1013.             AddSectionFilesToCopyList "ScanJet Plus MCA", SrcDir$, DEST$
  1014.         END IF
  1015.     END IF
  1016.  
  1017.     
  1018.     '' Add the driver files that match the type of interface card specified...
  1019.  
  1020.     IF ScannerChoice% = 1 THEN        '' ScanJet II or 3 family scanner...
  1021.  
  1022.         IF GetSymbolValue("RemingtonCardFound") = "1" THEN
  1023.             AddSectionFilesToCopyList "Remington Card Utils", SrcDir$, DEST$
  1024.             AddSectionFilesToCopyList "Remington Card Drivers", SrcDir$, DEST$
  1025.         ELSE
  1026.             AddSectionFilesToCopyList "Fred Card Drivers", SrcDir$, DEST$
  1027.         ENDIF
  1028.  
  1029.     ELSEIF ScannerChoice% = 2 THEN
  1030.  
  1031.         AddSectionFilesToCopyList "ScanJet Plus Utils", SrcDir$, DEST$
  1032.         AddSectionFilesToCopyList "ScanJet Plus Drivers", SrcDir$, DEST$
  1033.     END IF
  1034.  
  1035. END SUB
  1036.  
  1037.  
  1038.  
  1039. '*************************************************************************
  1040. '** Subroutine: Install
  1041. '** Purpose:    Performs all installation operations.
  1042. '** Arguments:     none.
  1043. '** Returns:     none.
  1044. '** History:
  1045. '**   940516 klb Added AcquireString() call for STR_NOTEPADEXE (local var
  1046. '**              is NotePadExeStr$).
  1047. '**              Changed hard-coded reference to "readme.txt" to result
  1048. '**              of AcquireString() on STR_READMETXT.
  1049. '**              Added label CONFIG:
  1050. '**              Commented out the CopyFile() immediately after CONFIG:.
  1051. '**              Replaced the UIPop 1 command in CONFIG: with a big
  1052. '**              IF/THEN/ELSE to treat the modification more intelligently.
  1053. '**              Commented out all the AUTOEXEC modify stuff because we're
  1054. '**              adding HPDS25.INI file support to the TWAIN stuff.
  1055. '**              Commented out all the old SYSTEM.INI code and replaced it
  1056. '**              wholesale with the SYSINI: block from the Kennel code.
  1057. '**              Commented out all the CONFIG.SYS modification stuff and
  1058. '**              replaced it wholesale with Kennel code (hope it works).
  1059. '**              Added UIPop1 to ELSE in GETREFDISKL1:.
  1060. '**   940518 klb Added code to write the HPDS25.INI file.
  1061. '**   940621 klb Deleted the line that was writing initialization info to
  1062. '**              the INI file -- this is wholly handled in WriteHPDSINI()
  1063. '**              now and shouldn't happen here.
  1064. '**              Added a CopyFile call so that the INI file created in the
  1065. '**              Windows directory is copied to the install directory.  That
  1066. '**              way, if the INI file gets trashed in the Windows directory,
  1067. '**              the user can just copy the original from the install dir
  1068. '**              and, assuming that DeskScan hasn't been moved, life will
  1069. '**              once again be wonderful.]
  1070. '**   940628 klb Third-party SCSI card (InstalledCard$ == 0) set ConfigFile$
  1071. '**              to the ScanJet Plus configuration file (!hwp1461.cfg)
  1072. '**              instead of the Fred file (!hwp2080.cfg).  So, I changed the
  1073. '**              string to the correct file name.
  1074. '**
  1075. '*************************************************************************
  1076. SUB Install STATIC
  1077.  
  1078.     CreateDir DEST$, cmoVital        ''    Create the destination directory...
  1079.  
  1080.     CopyFilesInCopyList                '' Copy files from distrib disk to dest disk
  1081.     
  1082.     ''    Create the Program Manager Group with the name specified by the user...
  1083.  
  1084.     CreateProgmanGroup GROUP$, "", cmoNone
  1085.     ShowProgmanGroup   GROUP$, 1,  cmoNone
  1086.  
  1087.     
  1088.     ''    Create the Program Manager Group Icons...
  1089.  
  1090.     NameStr$       = STRING$(128,0)
  1091.     NotePadExeStr$ = STRING$(16,0)
  1092.  
  1093.     i%       = AcquireString(STR_DESKSCAN,    NameStr$, 128)
  1094.     CreateProgManItem GROUP$, NameStr$, MakePath(DEST$, "HPCCOPY.EXE"), "", cmoOverwrite
  1095.  
  1096.     i%       = AcquireString(STR_SCSIADDRESS, NameStr$, 128)
  1097.     CreateProgManItem GROUP$, NameStr$, MakePath(DEST$, "SCSIADDR.EXE"), "", cmoOverwrite
  1098.  
  1099.     i%       = AcquireString(STR_SCANNERTEST, NameStr$, 128)
  1100.     CreateProgManItem GROUP$, NameStr$, MakePath(DEST$, "SCANTEST.EXE"), "", cmoOverwrite
  1101.  
  1102.     i%       = AcquireString(STR_READMETXT,   NameStr$, 128)
  1103.     i%       = AcquireString(STR_NOTEPADEXE,  NotePadExeStr$, 16)
  1104.     CreateProgManItem GROUP$, NameStr$, NotePadExeStr$+" "+MakePath(DEST$, NameStr$), "", cmoOverwrite
  1105.  
  1106.     i%       = AcquireString(STR_LICENSETXT,   NameStr$, 128)
  1107.     CreateProgManItem GROUP$, NameStr$, NotePadExeStr$+" "+MakePath(DEST$, NameStr$), "", cmoOverwrite
  1108.  
  1109.     NotePadExeStr$ = STRING$(0,0)
  1110.     NameStr$       = STRING$(0,0)
  1111.  
  1112.  
  1113.     ''    write our TWAIN data source .ini file...
  1114.  
  1115. ''    DSIniStr$ = STRING$(16,0)
  1116. ''    i% = AcquireString(STR_HPDSINI, DSIniStr$, 16)
  1117. ''    i% = WriteHPDSINI()
  1118.  
  1119. ''    '' Make a copy of the INI file in the install directory so recovery is easy
  1120. ''
  1121. ''    CopyFile WinDir$+DSIniStr$, DEST$+"\"+DSIniStr$, cmoOverwrite, 0
  1122. ''    DSIniStr$ = STRING$(0,0)
  1123. ''
  1124. ''    '' Make a copy of the TWAIN data source file into the install directory...
  1125. ''
  1126. ''    CopyFile TWAINDir$+"HPDS21.DS", DEST$+"\HPDS21.DS", cmoOverwrite, 0
  1127.  
  1128.  
  1129.  
  1130. CONFIG:    
  1131.     AskModSysIni%   = 0
  1132.  
  1133.     ''    Make a temporary copy of the CONFIG.SYS.  If we aren't told to modify
  1134.     ''    the SYS file, we'll delete it and the user won't know it was there...
  1135.  
  1136.     CopyFile "C:\CONFIG.SYS", GetSymbolValue("ConfigBackup"), cmoOverwrite, 0
  1137.  
  1138.     '' ********************************
  1139.     '' *** Modify CONFIG.SYS dialog ***
  1140.     '' ********************************
  1141.  
  1142.     sz$ = UIStartDlg(DS2Cui$, MODIFYCONFIG, "FModifyConfigDlgProc", 0, "")
  1143.  
  1144.     IF (sz$ = "CONTINUE") THEN    '' User wants us to mod CONFIG for them...
  1145.         UIPop 1                        '' FModifyConfigDlgProc() updated 'ConfigTemp'...
  1146.         CopyFile   GetSymbolValue("ConfigTemp"), "C:\CONFIG.SYS", cmoOverwrite,0
  1147.         RemoveFile GetSymbolValue("ConfigTemp"), cmoNone
  1148. ''        MUSTREBOOT% = 1
  1149.  
  1150.     ELSEIF sz$ = "REACTIVATE" THEN
  1151.         GOTO CONFIG
  1152.  
  1153.     ELSE                                '' User wants us to leave CONFIG file alone...
  1154.         UIPop 1                        '' CONFIG file not mod'd so delete the temp file...
  1155.         RemoveFile GetSymbolValue("ConfigBackup"), cmoNone
  1156. ''        MANUALMOD% = 1
  1157.     END IF
  1158.  
  1159.     ''
  1160.     '' The 'InstalledCard' symbol's values are defined in ds2cui.h.
  1161.     '' Since we "know" which card is being used, decide now whether the user
  1162.     '' may want us to modify their SYSTEM.INI file for them.
  1163.     ''
  1164.     InstalledCard$ = GetSymbolValue("InstalledCard")
  1165.  
  1166.     IF InstalledCard$="0" THEN            '' No Card detected...
  1167.         AskModSysIni% = 1                    '' Assume it'll be a Fred card eventually
  1168.  
  1169.     ELSEIF InstalledCard$="1" THEN    '' ScanJet Plus card
  1170.         AskModSysIni% = 0
  1171.  
  1172.     ELSEIF InstalledCard$="2" THEN    '' SJ Plus card in certain Gateway CPUs
  1173.         AskModSysIni% = 0
  1174.  
  1175.     ELSEIF InstalledCard$="3" THEN    '' Remington SCSI card
  1176. ''        AskModSysIni% = 0
  1177.         AskModSysIni% = 1                    '' Add EMMExclude line
  1178.  
  1179.     ELSEIF InstalledCard$="4" THEN    '' Fred SCSI card
  1180.         AskModSysIni% = 1                    '' Add high-performance drivers
  1181.  
  1182.     ELSEIF InstalledCard$="5" THEN    '' 3rd-party SCSI card
  1183.         AskModSysIni% = 0
  1184.     END IF
  1185.  
  1186.  
  1187.  
  1188.  
  1189. CHECKSYSINIFORHIPERF:        '' Our high-performance drivers (VxDs) in SYSTEM.INI?
  1190.  
  1191.     CopyFile WinDir$+"SYSTEM.INI", GetSymbolValue("SysIniThrowAwayFile"), cmoOverwrite, 0
  1192.     i% = FCheckForHiPerfDrivers()
  1193.  
  1194.     '' Regardless of the outcome of the search, dispose of our temp file...
  1195.     RemoveFile GetSymbolValue("SysIniThrowAwayFile"), cmoNone
  1196.  
  1197.     IF i% = 0 THEN                        '' >0 means one or more of our VxDs were found
  1198.         GOTO SYSINI                        '' 0 means none of our VxDs were found
  1199.     END IF
  1200.  
  1201.     '' ****************************************************
  1202.     '' *** Remove Unused Drivers from SYSTEM.INI dialog ***
  1203.     '' ****************************************************
  1204.     sz$ = UIStartDlg(DS2Cui$, REMOVEHIPERF, "FRemoveHiPerfDlgProc", 0, "")
  1205.  
  1206.     IF sz$ = "CONTINUE" THEN        '' Pressed the "Yes" button
  1207.         UIPop 1
  1208.         CopyFile   WinDir$+"SYSTEM.INI", GetSymbolValue("SysIniBackup"), cmoOverwrite, 0
  1209.         i% = FRemoveHiPerfDrivers()
  1210.  
  1211.         IF i% = 0 THEN                    '' FRemoveHiPerfDrivers() failed...
  1212.             RemoveFile GetSymbolValue("SysIniBackup"), cmoNone
  1213.             '$IFDEF DEBUG
  1214.                 i% = DoMsgBox("FRemoveHiPerDrivers() failed to remove VxDs!", "DEBUG", MB_OK+MB_TASKMODAL)
  1215.             '$ENDIF
  1216.         
  1217.         ELSE                                '' VxDs removed OK so save our changes...
  1218.             RemoveFile WinDir$+"SYSTEM.INI", cmoNone
  1219.             RenameFile GetSymbolValue("SysIniTemp"), "SYSTEM.INI"
  1220. ''            MUSTREBOOT% = 1
  1221.         ENDIF
  1222.  
  1223.         GOTO SYSINI                        '' in any event, go on...
  1224.  
  1225.     ELSEIF sz$ = "REACTIVATE" THEN
  1226.         GOTO CHECKSYSINIFORHIPERF
  1227.  
  1228.     ELSEIF sz$ = "EXIT" THEN        '' Pressed the "Exit" button
  1229.         UIPop 1
  1230.         GOSUB ASKQUIT2
  1231.         GOTO CHECKSYSINIFORHIPERF
  1232.  
  1233.     ELSEIF sz$ = "CANCEL" THEN        '' Pressed the "No" button
  1234.         UIPop 1
  1235. ''        MANUALMOD% = 1
  1236.         GOTO MANUALSYSINI
  1237.  
  1238.     ELSE
  1239.         UIPop 1
  1240.     END IF
  1241.  
  1242.  
  1243.  
  1244. MANUALSYSINI:
  1245.     '' ****************************************************
  1246.     '' *** Manually update SYSTEM.INI dialog ***
  1247.     '' ****************************************************
  1248.     sz$ = UIStartDlg(DS2Cui$, HIPERFNAMES, "FManualSysIniDlgProc", 0, "")
  1249.  
  1250.     '' Process the result of "FManualSysIniDlgProc"
  1251.  
  1252.     IF sz$ = "CONTINUE" THEN
  1253.         UIPop 1
  1254.         GOTO SYSINI
  1255.         
  1256.     ELSEIF sz$ = "BACK" THEN
  1257.         UIPop 1
  1258.         GOTO CHECKSYSINIFORHIPERF
  1259.  
  1260.     ELSEIF sz$= "REACTIVATE" THEN
  1261.         GOTO MANUALSYSINI
  1262.  
  1263.     ELSE
  1264.         UIPop 1
  1265.         GOTO SYSINI
  1266.     END IF
  1267.  
  1268.  
  1269.  
  1270.  
  1271. SYSINI:
  1272.     IF AskModSysIni% = 0 THEN                    '' gate the SYSTEM.INI mod dialog
  1273.         GOTO EISA_MCA_FILES
  1274.     END IF
  1275.  
  1276.     ''
  1277.     '' The 'InstalledCard' symbol's values are defined in ds2cui.h.
  1278.     ''
  1279.     InstalledCard$ = GetSymbolValue("InstalledCard")
  1280.  
  1281.  
  1282.     '' ********************************
  1283.     '' *** Modify SYSTEM.INI dialog ***
  1284.     '' ********************************
  1285.     IF InstalledCard$ = "3" THEN                '' Remington SCSI Card
  1286.         sz$ = UIStartDlg(DS2Cui$, MODIFYIICSYSTEMINI, "FYesNoDlgProc", 0, "")
  1287.      ELSE                                                '' Fred SCSI Card
  1288.         sz$ = UIStartDlg(DS2Cui$, MODIFYSYSTEMINI, "FYesNoDlgProc", 0, "")
  1289.     END IF
  1290.  
  1291.     IF sz$ = "CONTINUE" THEN
  1292.         UIPop 1
  1293. ''        MUSTREBOOT% = 1
  1294.         CopyFile WinDir$+"SYSTEM.INI", GetSymbolValue("SysIniBackup"), cmoOverwrite,0
  1295.         i% = ModifySysIni()
  1296.  
  1297.         IF i% <> 0 THEN                            '' only if ModifySysIni() suceeds...
  1298.             RemoveFile WinDir$+"SYSTEM.INI", cmoNone
  1299.             RenameFile GetSymbolValue("SysIniTemp"), "SYSTEM.INI"
  1300.  
  1301.         ELSE
  1302.             RemoveFile GetSymbolValue("SysIniTemp"), cmoNone
  1303.         END IF
  1304.  
  1305.     ELSEIF sz$ = "REACTIVATE" THEN
  1306.         GOTO SYSINI
  1307.  
  1308.     ELSE
  1309.         UIPop 1
  1310. ''        MANUALMOD% = 1
  1311.     END IF
  1312.  
  1313.  
  1314. EISA_MCA_FILES:
  1315.     ''
  1316.     '' The 'InstalledCard' symbol's values are defined in ds2cui.h.
  1317.     ''
  1318.     InstalledCard$ = GetSymbolValue("InstalledCard")
  1319.  
  1320.     IF InstalledCard$ = "5" THEN                '' 3rd party SCSI
  1321.         GOTO DONE
  1322.     ENDIF
  1323.         
  1324.     IF (SystemArchitecture$ = "MCA") THEN
  1325.         IF InstalledCard$ = "0" THEN            '' No card found, assume Fred card
  1326.             ConfigFile$ = "@631f.adf"
  1327.  
  1328.         ELSEIF InstalledCard$ = "1" THEN        '' ScanJet Plus card
  1329.             ConfigFile$ = "@601f.adf"
  1330.  
  1331.         ELSEIF InstalledCard$ = "2" THEN        '' ScanJet Plus card in some Gateways
  1332.             ConfigFile$ = "@601f.adf"
  1333.  
  1334.         ELSEIF InstalledCard$ = "3" THEN        '' Remington SCSI card
  1335.             ConfigFile$ = "@621f.adf"
  1336.  
  1337.         ELSEIF InstalledCard$ = "4" THEN        '' Fred SCSI card
  1338.             ConfigFile$ = "@631f.adf"
  1339.         END IF
  1340.  
  1341. ''        GOTO DONE                                    '' Don't ask for EISA Reference Disk
  1342.  
  1343.     ELSEIF (SystemArchitecture$ = "EISA") THEN
  1344.         IF InstalledCard$ = "0" THEN            '' No card found, assume Fred card
  1345.             ConfigFile$ = "!hwp2080.cfg"
  1346.  
  1347.         ELSEIF InstalledCard$ = "1" THEN        '' ScanJet Plus card
  1348.             ConfigFile$ = "!hwp1461.cfg"
  1349.  
  1350.         ELSEIF InstalledCard$ = "2" THEN        '' ScanJet Plus card in some Gateways
  1351.             ConfigFile$ = "!hwp1461.cfg"
  1352.  
  1353.         ELSEIF InstalledCard$ = "3" THEN        '' Remington SCSI card
  1354.             ConfigFile$ = "!hwp2002.cfg"
  1355.  
  1356.         ELSEIF InstalledCard$ = "4" THEN        '' Fred SCSI card
  1357.             ConfigFile$ = "!hwp2080.cfg"
  1358.         END IF
  1359.  
  1360.         GOTO GETREFDISK
  1361.  
  1362.     ELSE                                                '' System Architecture is "ISA"
  1363.         GOTO DONE
  1364.     ENDIF
  1365.  
  1366.  
  1367.  
  1368. GETREFDISK:
  1369.     SetSymbolValue "EditTextIn", "A:\"
  1370.     SetSymbolValue "EditFocus", "END"
  1371.  
  1372. GETREFDISKL1:
  1373.     '' ************************************
  1374.     '' *** Backup Reference Disk dialog ***
  1375.     '' ************************************
  1376.     sz$      = UIStartDlg(DS2Cui$, INSERTREF, "FRefDiskDlgProc", 0, "")
  1377.     refDisk$ = GetSymbolValue("EditTextOut")
  1378.     tStr$    = refDisk$
  1379.  
  1380.     IF (MID$(refDisk$,LEN(refDisk$)) <> "\") THEN
  1381.         refDisk$ = tStr$ + "\"
  1382.     END IF
  1383.  
  1384.     IF (sz$ = "CONTINUE") THEN
  1385.         UIPop 1
  1386.  
  1387.         IF (IsDirWritable(refDisk$) = 0) THEN
  1388.             GOSUB BADPATH
  1389.             GOTO GETREFDISKL1
  1390.         END IF
  1391.  
  1392.         CopyFile MakePath(DEST$,ConfigFile$), MakePath(refDisk$,ConfigFile$), cmoNone, 0
  1393.  
  1394.     ELSEIF sz$ = "REACTIVATE" THEN
  1395.         GOTO GETREFDISKL1
  1396.  
  1397.     ELSEIF sz$ = "BACK" THEN
  1398.         UIPop 1
  1399.         GOTO DONE
  1400.  
  1401.     ELSE
  1402.         UIPop 1
  1403.          GOSUB ASKQUIT2
  1404.         GOTO GETREFDISK
  1405.     END IF
  1406.  
  1407. GOTO DONE
  1408.  
  1409.  
  1410.  
  1411. BADPATH:
  1412.     '' ****************************************
  1413.     '' *** Unknown Path or Directory dialog ***
  1414.     '' ****************************************
  1415.     sz$ = UIStartDlg(DS2Cui$, BADPATH, "FInfo0DlgProc", 0, "")
  1416.  
  1417.     IF sz$ = "REACTIVATE" THEN
  1418.         GOTO BADPATH
  1419.     END IF
  1420.  
  1421.     UIPop 1
  1422.     RETURN
  1423.  
  1424.  
  1425.  
  1426. ASKQUIT2:
  1427.     '' *******************************
  1428.     '' *** Incomplete Setup dialog ***
  1429.     '' *******************************
  1430.     sz$ = UIStartDlg(DS2Cui$, ASKQUIT, "FQuitDlgProc", 0, "")
  1431.  
  1432.     IF sz$ = "EXIT" THEN
  1433.         UIPopAll
  1434.         ERROR STFQUIT
  1435.     
  1436.     ELSEIF sz$ = "REACTIVATE" THEN
  1437.         GOTO ASKQUIT2
  1438.  
  1439.     ELSE
  1440.         UIPop 1
  1441.     END IF
  1442.  
  1443.     RETURN
  1444.  
  1445.  
  1446.  
  1447. DONE:
  1448. END SUB
  1449.  
  1450.  
  1451.  
  1452. '*************************************************************************
  1453. '** Subroutine: MakePath
  1454. '** Purpose:    Appends a file name to the end of a directory path,
  1455. '**             inserting a backslash character as needed.
  1456. '** Arguments:
  1457. '**    szDir$   full directory path (with optional ending "\")
  1458. '**    szFile$  filename to append to directory
  1459. '** Returns:     Resulting fully qualified path name.
  1460. '*************************************************************************
  1461. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  1462.  
  1463.     IF szDir$ = "" THEN
  1464.         MakePath = szFile$
  1465.  
  1466.     ELSEIF szFile$ = "" THEN
  1467.         MakePath = szDir$
  1468.  
  1469.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  1470.         MakePath = szDir$ + szFile$
  1471.  
  1472.     ELSE
  1473.         MakePath = szDir$ + "\" + szFile$
  1474.     END IF
  1475.  
  1476. END FUNCTION
  1477.  
  1478.  
  1479.  
  1480.  
  1481. '*************************************************************************
  1482. '** Subroutine: MyRemoveFiles
  1483. '** Purpose:    Deletes any files from the destination disk that are
  1484. '**             used by the Installer but not by the scanning software.
  1485. '** Arguments:     none.
  1486. '** Returns:     none.
  1487. '** History:    940427 klb Created.
  1488. '*************************************************************************
  1489. SUB MyRemoveFiles STATIC
  1490.  
  1491.     oldcursor% = ShowWaitCursor()
  1492.     
  1493.     IF (DoesFileExist(MakePath(DEST$, "scanjet.inf"), femExists) = 1) THEN
  1494.         RemoveFile MakePath(DEST$, "scanjet.inf"), cmoForce
  1495.     END IF
  1496.  
  1497.     IF (DoesFileExist(MakePath(DEST$, "scanjet.mst"), femExists) = 1) THEN
  1498.         RemoveFile MakePath(DEST$, "scanjet.mst"), cmoForce
  1499.     END IF
  1500.  
  1501.     IF (DoesFileExist(MakePath(DEST$, "ddeml.dll"), femExists) = 1) THEN
  1502.         RemoveFile MakePath(DEST$, "ddeml.dll"), cmoForce
  1503.     END IF
  1504.  
  1505.     IF (DoesFileExist(MakePath(DEST$, "_mstest.exe"), femExists) = 1) THEN
  1506.         RemoveFile MakePath(DEST$, "_mstest.exe"), cmoForce
  1507.     END IF
  1508.  
  1509.     IF (DoesFileExist(MakePath(DEST$, "ds2cui.dll"), femExists) = 1) THEN
  1510.         RemoveFile MakePath(DEST$, "ds2cui.dll"), cmoForce
  1511.     END IF
  1512.  
  1513.     IF (DoesFileExist(MakePath(DEST$, "ds2util.inc"), femExists) = 1) THEN
  1514.         RemoveFile MakePath(DEST$, "ds2util.inc"), cmoForce
  1515.     END IF
  1516.  
  1517.     IF (DoesFileExist(MakePath(DEST$, "ds2util.dll"), femExists) = 1) THEN
  1518.         RemoveFile MakePath(DEST$, "ds2util.dll"), cmoForce
  1519.     END IF
  1520.  
  1521.     IF (DoesFileExist(MakePath(DEST$, "setup.exe"), femExists) = 1) THEN
  1522.         RemoveFile MakePath(DEST$, "setup.exe"), cmoForce
  1523.     END IF
  1524.  
  1525.     IF (DoesFileExist(MakePath(DEST$, "setup.lst"), femExists) = 1) THEN
  1526.         RemoveFile MakePath(DEST$, "setup.lst"), cmoForce
  1527.     END IF
  1528.  
  1529.     IF (DoesFileExist(MakePath(DEST$, "setupapi.inc"), femExists) = 1) THEN
  1530.         RemoveFile MakePath(DEST$, "setupapi.inc"), cmoForce
  1531.     END IF
  1532.  
  1533.     IF (DoesFileExist(MakePath(DEST$, "mscomstf.dll"), femExists) = 1) THEN
  1534.         RemoveFile MakePath(DEST$, "mscomstf.dll"), cmoForce
  1535.     END IF
  1536.  
  1537.     IF (DoesFileExist(MakePath(DEST$, "msdetect.inc"), femExists) = 1) THEN
  1538.         RemoveFile MakePath(DEST$, "msdetect.inc"), cmoForce
  1539.     END IF
  1540.  
  1541.     IF (DoesFileExist(MakePath(DEST$, "msdetstf.dll"), femExists) = 1) THEN
  1542.         RemoveFile MakePath(DEST$, "msdetstf.dll"), cmoForce
  1543.     END IF
  1544.  
  1545.     IF (DoesFileExist(MakePath(DEST$, "msinsstf.dll"), femExists) = 1) THEN
  1546.         RemoveFile MakePath(DEST$, "msinsstf.dll"), cmoForce
  1547.     END IF
  1548.  
  1549.     IF (DoesFileExist(MakePath(DEST$, "msshlstf.dll"), femExists) = 1) THEN
  1550.         RemoveFile MakePath(DEST$, "msshlstf.dll"), cmoForce
  1551.     END IF
  1552.  
  1553.     IF (DoesFileExist(MakePath(DEST$, "msuilstf.dll"), femExists) = 1) THEN
  1554.         RemoveFile MakePath(DEST$, "msuilstf.dll"), cmoForce
  1555.     END IF
  1556.  
  1557.     IF (DoesFileExist(MakePath(DEST$, "expand.exe"), femExists) = 1) THEN
  1558.         RemoveFile MakePath(DEST$, "expand.exe"), cmoForce
  1559.     END IF
  1560.  
  1561. ''    IF (DoesFileExist(MakePath(TwainDir$, "hpdsii.ds"), femExists) = 1) THEN
  1562. ''        RenameFile MakePath(TwainDir$, "hpdsii.ds"), "hpdsii.old"
  1563. ''    END IF
  1564.  
  1565.     RestoreCursor oldcursor
  1566.  
  1567. END SUB
  1568.