home *** CD-ROM | disk | FTP | other *** search
/ Planet Art: The Surrealists / PCD1152.BIN / apps / kpi_v11 / win / kpi.mst < prev    next >
Text File  |  1995-11-27  |  31KB  |  805 lines

  1. '**************************************************************************
  2. '*                      Kodak Photo Insert Setup
  3. '**************************************************************************
  4.  
  5. '$DEFINE DEBUG  ''Define for script development/debugging
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8. '$INCLUDE 'msdetect.inc'
  9.  
  10. ''Dialog ID's
  11. CONST ASKQUIT      = 200
  12. CONST DESTPATH     = 300
  13. CONST EXITFAILURE  = 400
  14. CONST EXITQUIT     = 600
  15. CONST EXITSUCCESS  = 700
  16. CONST OPTIONS      = 800
  17. CONST APPHELP      = 900
  18. CONST CUSTINST     = 6200
  19. CONST TOOBIG       = 6300
  20. CONST BADPATH      = 6400
  21.  
  22. ''Bitmap ID
  23. CONST LOGO         = 1
  24.  
  25. '' More DoMsgBox flags - not included in SETUPAPI.INC (for no apparent reason)
  26. CONST MB_YESNO  = 4
  27. CONST MB_ICONQUESTION = 32
  28. CONST IDYES = 6
  29. CONST IDNO = 7
  30.  
  31. '' Installation options
  32. CONST WINWORD           = 1     ' Microsoft Word
  33. CONST WORDPERFECT       = 2     ' Novell WordPerfect
  34. CONST WINWORKS          = 3     ' Microsoft Works
  35. CONST MSPUB             = 4     ' Microsoft Publisher
  36.  
  37. CONST TRUE      = 1
  38. CONST FALSE     = 0
  39.  
  40.  
  41. GLOBAL DEST$        ''Default destination directory.
  42. GLOBAL WINDRIVE$    ''Windows drive letter.
  43. GLOBAL OPT1OPT$     ''Option selection from OptFiles1 option dialog.
  44. GLOBAL OPT2OPT$     ''Option selection from OptFiles2 option dialog.
  45.  
  46. GLOBAL RebootMsg%       '       Reboot message
  47.  
  48. ''CustInst list symbol names
  49. GLOBAL OPT1NEEDS$    ''Option list costs per drive
  50. GLOBAL OPT2NEEDS$
  51. GLOBAL OPT3NEEDS$
  52. GLOBAL OPT4NEEDS$
  53. GLOBAL EXTRACOSTS$  ''List of extra costs to add per drive
  54. GLOBAL BIGLIST$     ''List of option files cost calc results (boolean)
  55.  
  56. ''Dialog list symbol names
  57. GLOBAL CHECKSTATES$
  58. GLOBAL STATUSTEXT$
  59. GLOBAL DRIVETEXT$
  60.  
  61.  
  62. DECLARE SUB AddOptFilesToCopyList (ftype%)
  63. DECLARE SUB RecalcOptFiles (ftype%, fInUse%)
  64. DECLARE SUB RecalcPath
  65. DECLARE SUB SetDriveStatus
  66. DECLARE FUNCTION GetDriveStatus AS INTEGER
  67. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  68. DECLARE FUNCTION GetPathName LIB "paths.dll" (szPath$) AS INTEGER
  69. DECLARE FUNCTION OkToInstall LIB "paths.dll" (installPath$,  option%) AS INTEGER
  70. DECLARE FUNCTION GetWordPerfectPath LIB "paths.dll" (pathName$) AS INTEGER
  71. DECLARE FUNCTION GetWinWordPath LIB "paths.dll" (pathName$) AS INTEGER
  72. DECLARE FUNCTION AddPathToAutoexec LIB "paths.dll" (pathName$) AS INTEGER
  73. DECLARE FUNCTION RemoveRunFromWindows LIB "paths.dll" (runName$) AS INTEGER
  74.  
  75. ' Windows messaging calls required to reboot after setup complete
  76. DECLARE FUNCTION PostMessage LIB "user" (hwnd%, msg%, wparam%, lparam&) AS INTEGER
  77. DECLARE FUNCTION RegisterWindowMessage LIB "user" (szRebootMessage$) AS INTEGER
  78.  
  79. INIT:
  80.     CUIDLL$ = "mscuistf.dll"            ''custom user interface dll
  81.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  82.  
  83.     SetBitmap CUIDLL$, LOGO
  84.     SetTitle "KODAK Digital Science Photo Insert Setup"
  85.  
  86.     '       Register NSetup reboot message
  87.     RebootMsg% = RegisterWindowMessage ("NSetup")
  88.  
  89.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  90.     IF szInf$ = "" THEN
  91.     szInf$ = GetSymbolValue("STF_CWDDIR") + "KPI.INF"
  92.     END IF
  93.     ReadInfFile szInf$
  94.  
  95.     WINDRIVE$ = MID$(GetWindowsDir(), 1, 1)
  96.     DEST$ = WINDRIVE$ + ":\KPI"
  97.     
  98.     systemOK% = OkToInstall ("",  0)
  99.     IF systemOK% >= 0 THEN
  100.         systemOK% = 0
  101.     ELSE
  102.         IF systemOK% = -1 THEN
  103.             dontCare% = DoMsgBox("Setup sources were corrupted. Please call technical support.", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  104.         ELSEIF systemOK% = -2 THEN
  105.             dontCare% = DoMsgBox("There is not enough memory on your system.  You must have at least 8MB of physical RAM and 8MB of virtual memory.", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  106.         ELSEIF systemOK% = -3 THEN
  107.             dontCare% = DoMsgBox("This version of Windows is not supported by Kodak Digital Science Photo Insert.", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  108.         ELSEIF systemOK% = -4 THEN
  109.             dontCare% = DoMsgBox("Object Linking and Embedding version 2.0 must be installed first.", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  110.         END IF
  111.         ERROR STFQUIT
  112.         END
  113.     END IF
  114.     
  115.     ''CustInst list symbols
  116.     CHECKSTATES$ = "CheckItemsState"
  117.     STATUSTEXT$  = "StatusItemsText"
  118.     DRIVETEXT$   = "DriveStatusText"
  119.     AddListItem CHECKSTATES$, "ON"
  120.     FOR i% = 2 TO 4 STEP 1
  121.     AddListItem CHECKSTATES$, "OFF"
  122.     NEXT i%
  123.     FOR i% = 1 TO 4 STEP 1
  124.     AddListItem STATUSTEXT$, ""
  125.     NEXT i%
  126.     FOR i% = 1 TO 7 STEP 1
  127.     AddListItem DRIVETEXT$, ""
  128.     NEXT i%
  129.     ReplaceListItem DRIVETEXT$, 7, DEST$
  130.  
  131.     ''Disk cost list symbols
  132.     OPT1NEEDS$  = "WINWORD"
  133.     OPT2NEEDS$  = "WORDPERFECT"
  134.     OPT3NEEDS$  = "WINWORKS"
  135.     OPT4NEEDS$  = "MSPUB"
  136.     EXTRACOSTS$ = "ExtraCosts"
  137.     BIGLIST$    = "BigList"
  138.     FOR i% = 1 TO 4 STEP 1
  139.     AddListItem BIGLIST$, ""
  140.     NEXT i%
  141.     FOR i% = 1 TO 26 STEP 1
  142.     AddListItem EXTRACOSTS$, "0"
  143.     NEXT i%
  144.  
  145.     ''File Option Variables
  146.     OPT1OPT$ = "1"
  147.     OPT2OPT$ = "1"
  148.  
  149.     RecalcPath
  150.     SetDriveStatus
  151.  
  152. '$IFDEF DEBUG
  153.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  154. '$ENDIF ''DEBUG
  155.  
  156. ''    GOTO GETPATH
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163. CUSTINST:
  164.     sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
  165.  
  166.     IF sz$ = "CONTINUE" THEN
  167.     ''Install only if it will fit.
  168. ''        FOR i% = 1 TO 3 STEP 1
  169. ''            IF GetListItem(BIGLIST$, i%) <> "" THEN
  170. ''                GOSUB TOOBIG
  171. ''                GOTO CUSTINST
  172. ''            END IF
  173. ''        NEXT i%
  174. ''        IF GetDriveStatus = 0 THEN
  175. ''            GOSUB TOOBIG
  176. ''            GOTO CUSTINST
  177. ''        END IF
  178.         
  179.         '' see if we can install
  180.         IF GetListItem(CHECKSTATES$, WINWORD) = "ON" THEN
  181.             selectedWP% = WINWORD
  182.         ELSEIF GetListItem(CHECKSTATES$, WORDPERFECT) = "ON" THEN
  183.             selectedWP% = WORDPERFECT
  184.         ELSEIF GetListItem(CHECKSTATES$, WINWORKS) = "ON" THEN
  185.             selectedWP% = WINWORKS
  186.         ELSE
  187.             selectedWP% = MSPUB
  188.         END IF
  189.         
  190.         okToProceed% = OkToInstall (DEST$,  selectedWP%)
  191.         IF okToProceed% <> 0 AND okToProceed%<> 3 THEN
  192.         IF okToProceed% = 2 THEN
  193.             dontCare% = DoMsgBox("The selected word processor does not appear to be installed on your machine. Please choose another.", "Setup Message", MB_OK+MB_ICONHAND)
  194.         ELSEIF okToProceed% = 1 THEN
  195.             GOSUB TOOBIG
  196.         ELSE
  197.             dontCare% = DoMsgBox("An unexpected error occured during setup. Please contact technical support for assistance.", "Setup Message", MB_OK+MB_ICONHAND)
  198.         ENDIF
  199.         GOTO CUSTINST
  200.         END IF
  201.  
  202.         IF okToProceed% = 3 THEN            
  203.             warningText$ = "Kodak Photo Insert has detected that your system is in a 256-color (or lower) video mode."
  204.             warningText$ = warningText$ + " Continuing in this mode will result in degraded performance and image quality."
  205.             warningText$ = warningText$ + " For best image quality and performance, it is recommended that you switch your video mode to a 64K-color or higher mode."
  206.             dontCare% = DoMsgBox(warningText$, "Setup Message", MB_OK+MB_ICONINFORMATION)
  207.         ENDIF
  208.  
  209.     UIPop 1
  210.     GOTO INSTALL
  211.     ELSEIF sz$ = "PATH" THEN
  212.     GOTO GETPATH
  213.     ELSEIF sz$ = "CHK1" THEN
  214.         ReplaceListItem CHECKSTATES$, WINWORD, "ON"
  215.         ReplaceListItem CHECKSTATES$, WORDPERFECT, "OFF"
  216.         ReplaceListItem CHECKSTATES$, WINWORKS, "OFF"
  217.         ReplaceListItem CHECKSTATES$, MSPUB, "OFF"
  218.         RecalcOptFiles MSPUB, FALSE
  219.         RecalcOptFiles WORDPERFECT, FALSE
  220.         RecalcOptFiles WINWORKS, FALSE
  221.         RecalcOptFiles WINWORD, TRUE
  222.         SetDriveStatus
  223.         GOTO CUSTINST
  224.     ELSEIF sz$ = "CHK2" THEN
  225.         ReplaceListItem CHECKSTATES$, WINWORD, "OFF"
  226.         ReplaceListItem CHECKSTATES$, WORDPERFECT, "ON"
  227.         ReplaceListItem CHECKSTATES$, WINWORKS, "OFF"
  228.         ReplaceListItem CHECKSTATES$, MSPUB, "OFF"
  229.         RecalcOptFiles WINWORD, FALSE
  230.         RecalcOptFiles WINWORKS, FALSE
  231.         RecalcOptFiles MSPUB, FALSE
  232.         RecalcOptFiles WORDPERFECT, TRUE
  233.         SetDriveStatus
  234.         GOTO CUSTINST
  235.     ELSEIF sz$ = "CHK3" THEN
  236.         ReplaceListItem CHECKSTATES$, WINWORD, "OFF"
  237.         ReplaceListItem CHECKSTATES$, WORDPERFECT, "OFF"
  238.         ReplaceListItem CHECKSTATES$, WINWORKS, "ON"
  239.         ReplaceListItem CHECKSTATES$, MSPUB, "OFF"
  240.         RecalcOptFiles WINWORD, FALSE
  241.         RecalcOptFiles WORDPERFECT, FALSE
  242.         RecalcOptFiles MSPUB, FALSE
  243.         RecalcOptFiles WINWORKS, TRUE
  244.         SetDriveStatus
  245.         GOTO CUSTINST
  246.     ELSEIF sz$ = "CHK4" THEN
  247.         ReplaceListItem CHECKSTATES$, WINWORD, "OFF"
  248.         ReplaceListItem CHECKSTATES$, WORDPERFECT, "OFF"
  249.         ReplaceListItem CHECKSTATES$, WINWORKS, "OFF"
  250.         ReplaceListItem CHECKSTATES$, MSPUB, "ON"
  251.         RecalcOptFiles WINWORD, FALSE
  252.         RecalcOptFiles WORDPERFECT, FALSE
  253.         RecalcOptFiles MSPUB, TRUE
  254.         RecalcOptFiles WINWORKS, FALSE
  255.         SetDriveStatus
  256.         GOTO CUSTINST
  257.     ELSEIF sz$ = "REACTIVATE" THEN
  258.         RecalcPath
  259.         SetDriveStatus
  260.         GOTO CUSTINST
  261.     ELSE
  262.         GOSUB ASKQUIT
  263.         GOTO CUSTINST
  264.     END IF
  265.  
  266.  
  267.  
  268. INSTALL:
  269.     curPath$ = GetSymbolValue("STF_CWDDIR")
  270.     ClearCopyList
  271.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  272.     AddSectionFilesToCopyList "KPI", SrcDir$, DEST$
  273.     
  274.     '' copy KPI's INI file and KPCMS transform data file to the Windows directory
  275.     CopyFile MakePath(curPath$, "kpi.ini"), MakePath(GetWindowsDir(),"kpi.ini"), cmoOverwrite, 0
  276.     CopyFile MakePath(curPath$, "kpicms.dat"), MakePath(GetWindowsDir(),"kpicms.dat"), cmoOverwrite, 0
  277.    
  278.     '' if there is already a KPCMS.INI file, then copy files to the directories that it describes
  279.     '' otherwise, copy in ours and put stuff where it would go if the user has done a KCMS install
  280.     IF DoesFileExist(MakePath(GetWindowsDir(), "kpcms.ini"), femExists) = 1 THEN
  281.     '' there is already an installation of KPCMS
  282.     kcmsDrive$ = GetIniKeyString(MakePath(GetWindowsDir(), "kpcms.ini"), "KEPS Precision", "drive")
  283.     ptPath$ = GetIniKeyString(MakePath(GetWindowsDir(), "kpcms.ini"), "API", "pt_dir")
  284.     cpPath$ = GetIniKeyString(MakePath(GetWindowsDir(), "kpcms.ini"), "KCP", "cp_dir")
  285.         CopyFile MakePath(curPath$, "B_1565F.pt_"), MakePath(kcmsDrive$+ptPath$,"B-1565F.pt"), cmoOverwrite + cmoDecompress, 0
  286.         CopyFile MakePath(curPath$, "B_550W.pt_"), MakePath(kcmsDrive$+ptPath$,"B-550W.pt"), cmoOverwrite + cmoDecompress, 0
  287.         CopyFile MakePath(curPath$, "B_560WK.pt_"), MakePath(kcmsDrive$+ptPath$,"B-560WK.pt"), cmoOverwrite + cmoDecompress, 0
  288.         CopyFile MakePath(curPath$, "B_660W.pt_"), MakePath(kcmsDrive$+ptPath$,"B-660WK.pt"), cmoOverwrite + cmoDecompress, 0
  289.         CopyFile MakePath(curPath$, "B_850W.pt_"), MakePath(kcmsDrive$+ptPath$,"B-850W.pt"), cmoOverwrite + cmoDecompress, 0
  290.         CopyFile MakePath(curPath$, "B_BJC6EW.pt_"), MakePath(kcmsDrive$+ptPath$,"B-BJC6EW.pt"), cmoOverwrite + cmoDecompress, 0
  291.         CopyFile MakePath(curPath$, "B_CLW.pt_"), MakePath(kcmsDrive$+ptPath$,"B-CLW.pt"), cmoOverwrite + cmoDecompress, 0
  292.         CopyFile MakePath(curPath$, "B_EP360W.pt_"), MakePath(kcmsDrive$+ptPath$,"B-EP360W.pt"), cmoOverwrite + cmoDecompress, 0
  293.         CopyFile MakePath(curPath$, "B_EP720W.pt_"), MakePath(kcmsDrive$+ptPath$,"B-EP720W.pt"), cmoOverwrite + cmoDecompress, 0
  294.         CopyFile MakePath(curPath$, "cp01._"), MakePath(kcmsDrive$+cpPath$,"cp01."), cmoOverwrite+cmoDecompress, 0
  295.         CopyFile MakePath(curPath$, "cp02._"), MakePath(kcmsDrive$+cpPath$,"cp02."), cmoOverwrite+cmoDecompress, 0
  296.         CopyFile MakePath(curPath$, "cp04._"), MakePath(kcmsDrive$+cpPath$,"cp04."), cmoOverwrite+cmoDecompress, 0
  297.         CopyFile MakePath(curPath$, "cp05._"), MakePath(kcmsDrive$+cpPath$,"cp05."), cmoOverwrite+cmoDecompress, 0
  298.         CopyFile MakePath(curPath$, "cp07._"), MakePath(kcmsDrive$+cpPath$,"cp07."), cmoOverwrite+cmoDecompress, 0
  299.         CopyFile MakePath(curPath$, "cp08._"), MakePath(kcmsDrive$+cpPath$,"cp08."), cmoOverwrite+cmoDecompress, 0
  300.         CopyFile MakePath(curPath$, "cp09._"), MakePath(kcmsDrive$+cpPath$,"cp09."), cmoOverwrite+cmoDecompress, 0
  301.         CopyFile MakePath(curPath$, "cp10._"), MakePath(kcmsDrive$+cpPath$,"cp10."), cmoOverwrite+cmoDecompress, 0
  302.         CopyFile MakePath(curPath$, "cp10i._"), MakePath(kcmsDrive$+cpPath$,"cp10i."), cmoOverwrite+cmoDecompress, 0
  303.     ELSE
  304.     '' there is no previous installation of KPCMS
  305.     CopyFile MakePath(curPath$,"kpcms.ini"), MakePath(GetWindowsDir(),"kpcms.ini"), cmoOverwrite, 0
  306.     kcmsDrive$ = "c:\kpcms"
  307.     ptPath$ = "\dcpdb"
  308.     cpPath$ = "\cmscp"
  309.         CreateDir kcmsDrive$, cmoNone
  310.         CreateDir kcmsDrive$+ptPath$, cmoNone
  311.         CreateDir kcmsDrive$+cpPath$, cmoNone
  312.         CopyFile MakePath(curPath$, "B_1565F.pt_"), MakePath(kcmsDrive$+ptPath$,"B-1565F.pt"), cmoOverwrite + cmoDecompress, 0
  313.         CopyFile MakePath(curPath$, "B_550W.pt_"), MakePath(kcmsDrive$+ptPath$,"B-550W.pt"), cmoOverwrite + cmoDecompress, 0
  314.         CopyFile MakePath(curPath$, "B_560WK.pt_"), MakePath(kcmsDrive$+ptPath$,"B-560WK.pt"), cmoOverwrite + cmoDecompress, 0
  315.         CopyFile MakePath(curPath$, "B_660W.pt_"), MakePath(kcmsDrive$+ptPath$,"B-660WK.pt"), cmoOverwrite + cmoDecompress, 0
  316.         CopyFile MakePath(curPath$, "B_850W.pt_"), MakePath(kcmsDrive$+ptPath$,"B-850W.pt"), cmoOverwrite + cmoDecompress, 0
  317.         CopyFile MakePath(curPath$, "B_BJC6EW.pt_"), MakePath(kcmsDrive$+ptPath$,"B-BJC6EW.pt"), cmoOverwrite + cmoDecompress, 0
  318.         CopyFile MakePath(curPath$, "B_CLW.pt_"), MakePath(kcmsDrive$+ptPath$,"B-CLW.pt"), cmoOverwrite + cmoDecompress, 0
  319.         CopyFile MakePath(curPath$, "B_EP360W.pt_"), MakePath(kcmsDrive$+ptPath$,"B-EP360W.pt"), cmoOverwrite + cmoDecompress, 0
  320.         CopyFile MakePath(curPath$, "B_EP720W.pt_"), MakePath(kcmsDrive$+ptPath$,"B-EP720W.pt"), cmoOverwrite + cmoDecompress, 0
  321.         CopyFile MakePath(curPath$, "cp01._"), MakePath(kcmsDrive$+cpPath$,"cp01."), cmoOverwrite + cmoDecompress, 0
  322.         CopyFile MakePath(curPath$, "cp02._"), MakePath(kcmsDrive$+cpPath$,"cp02."), cmoOverwrite + cmoDecompress, 0
  323.         CopyFile MakePath(curPath$, "cp04._"), MakePath(kcmsDrive$+cpPath$,"cp04."), cmoOverwrite + cmoDecompress, 0
  324.         CopyFile MakePath(curPath$, "cp05._"), MakePath(kcmsDrive$+cpPath$,"cp05."), cmoOverwrite + cmoDecompress, 0
  325.         CopyFile MakePath(curPath$, "cp07._"), MakePath(kcmsDrive$+cpPath$,"cp07."), cmoOverwrite + cmoDecompress, 0
  326.         CopyFile MakePath(curPath$, "cp08._"), MakePath(kcmsDrive$+cpPath$,"cp08."), cmoOverwrite + cmoDecompress, 0
  327.         CopyFile MakePath(curPath$, "cp09._"), MakePath(kcmsDrive$+cpPath$,"cp09."), cmoOverwrite + cmoDecompress, 0
  328.         CopyFile MakePath(curPath$, "cp10._"), MakePath(kcmsDrive$+cpPath$,"cp10."), cmoOverwrite + cmoDecompress, 0
  329.         CopyFile MakePath(curPath$, "cp10i._"), MakePath(kcmsDrive$+cpPath$,"cp10i."), cmoOverwrite + cmoDecompress, 0
  330.     END IF
  331.     
  332.     '' copy the rest of the KPCMS stuff to the Windows directory
  333.     CopyFile MakePath(curPath$,"32kcme0.dl_"), MakePath(GetWindowsDir(),"32kcme0.dll"), cmoOverwrite + cmoDecompress, 0
  334.     CopyFile MakePath(curPath$,"kcme0.dl_"), MakePath(GetWindowsDir(),"kcme0.dll"), cmoOverwrite + cmoDecompress, 0
  335.     CopyFile MakePath(curPath$,"kcme1.dl_"), MakePath(GetWindowsDir(),"kcme1.dll"), cmoOverwrite + cmoDecompress, 0
  336.     CopyFile MakePath(curPath$,"kcms_sys.dl_"), MakePath(GetWindowsDir(),"kcms_sys.dll"), cmoOverwrite + cmoDecompress, 0
  337.     CopyFile MakePath(curPath$,"kpapi.dl_"), MakePath(GetWindowsDir(),"kpapi.dll"), cmoOverwrite + cmoDecompress, 0
  338.     CopyFile MakePath(curPath$,"kpcp.dl_"), MakePath(GetWindowsDir(),"kpcp.dll"), cmoOverwrite + cmoDecompress, 0
  339.     CopyFile MakePath(curPath$,"kpcp16.dl_"), MakePath(GetWindowsDir(),"kpcp16.dll"), cmoOverwrite + cmoDecompress, 0
  340.     CopyFile MakePath(curPath$,"kpmon.dl_"), MakePath(GetWindowsDir(),"kpmon.dll"), cmoOverwrite + cmoDecompress, 0
  341.     
  342.     '' remove the patches from the run line in WIN.INI
  343.     '' we can add them back later if needed
  344.     result% = RemoveRunFromWindows("DSSPTCH.EXE")
  345.  
  346.     IF GetListItem(CHECKSTATES$, WINWORD) = "ON" THEN
  347.         selectedWP% = WINWORD
  348.         AddOptFilesToCopyList WINWORD
  349.         CreateIniKeyValue MakePath(GetWindowsDir(),"kpi.ini"), "OLE", "UseInprocHandler", "0", cmoOverwrite
  350.         CreateIniKeyValue MakePath(GetWindowsDir(),"kpi.ini"), "OLE", "Application", "WINWORD", cmoOverwrite
  351.         CreateIniKeyValue MakePath(GetWindowsDir(),"kpi.ini"), "Templates", "Extension", "DOT", cmoOverwrite
  352.         winRun$ = GetIniKeyString( "WIN.INI", "windows", "run")
  353.         winRun$ = DEST$+"\DSSPTCH.EXE " + winRun$
  354.         CreateIniKeyValue "WIN.INI", "windows", "run", winRun$, cmoOverwrite
  355.         
  356.         '' Copy the KPI.DOT file to WinWord STARTUP directory
  357.         winwordFMExt$="**************************************************************"
  358.         success % = GetWinWordPath(winwordFMExt$)
  359.         CopyFile MakePath(curPath$, "kpi.dot"), MakePath(winwordFMExt$, "startup\kpi.dot"), cmoOverwrite, 0
  360.  
  361.         IF DoesFileExist(MakePath(winwordFMExt$, "winword.opt"), femExists) = 1 THEN
  362.             BackupFile MakePath(winwordFMExt$, "winword.opt"), "winopts.bak"
  363.         END IF
  364.         CopyFile MakePath(curPath$, "winword.opt"), MakePath(winwordFMExt$, "winword.opt"), cmoOverwrite, 0
  365.     ELSEIF GetListItem(CHECKSTATES$, WORDPERFECT) = "ON" THEN
  366.         selectedWP% = WORDPERFECT
  367.         AddOptFilesToCopyList WORDPERFECT
  368.         CreateIniKeyValue MakePath(GetWindowsDir(),"kpi.ini"), "OLE", "UseInprocHandler", "0", cmoOverwrite
  369.         CreateIniKeyValue MakePath(GetWindowsDir(),"kpi.ini"), "OLE", "Application", "WPWIN", cmoOverwrite
  370.         CreateIniKeyValue MakePath(GetWindowsDir(),"kpi.ini"), "Templates", "Extension", "WPT", cmoOverwrite
  371.         winRun$ = GetIniKeyString( "WIN.INI", "windows", "run")
  372.         winRun$ = DEST$+"\DSSPTCH.EXE " + winRun$
  373.         CreateIniKeyValue "WIN.INI", "windows", "run", winRun$, cmoOverwrite
  374.         
  375.         '' Copy necessary macros and templates into WordPerfect's directories, but backup WPWin originals
  376.         wpDir$ = "**************************************************************"
  377.         success% = GetWordPerfectPath (wpDir$)
  378.         IF DoesFileExist(MakePath(wpDir$, "template\standard.wpt"), femExists) = 1 THEN
  379.             BackupFile MakePath(wpDir$, "template\standard.wpt"), "standard.bak"
  380.         END IF
  381.         CreateDir MakePath(wpDir$, "template"), cmoNone
  382.         CopyFile MakePath(curPath$, "standard.wpt"), MakePath(wpDir$, "template\standard.wpt"), cmoOverwrite, 0
  383.         IF DoesFileExist( MakePath(wpDir$, "macros"), femExists) = 1 THEN
  384.             CopyFile MakePath(curPath$, "kpi.wcm"), MakePath(wpDir$, "macros\kpi.wcm"), cmoOverwrite, 0
  385.         ELSE
  386.             CopyFile MakePath(curPath$, "kpi.wcm"), MakePath(wpDir$, "kpi.wcm"), cmoOverwrite, 0
  387.         END IF
  388.     ELSEIF GetListItem(CHECKSTATES$, WINWORKS) = "ON" THEN
  389.         selectedWP% = WINWORKS
  390.         AddOptFilesToCopyList WINWORKS
  391.         CreateIniKeyValue MakePath(GetWindowsDir(),"kpi.ini"), "OLE", "UseInprocHandler", "0", cmoOverwrite
  392.         CreateIniKeyValue MakePath(GetWindowsDir(),"kpi.ini"), "OLE", "Application", "WINWORKS", cmoOverwrite
  393.         CreateIniKeyValue MakePath(GetWindowsDir(),"kpi.ini"), "Templates", "Extension", "WPS", cmoOverwrite
  394.         
  395.         winRun$ = GetIniKeyString( "WIN.INI", "windows", "run")
  396.         winRun$ = DEST$+"\DSSPTCH.EXE " + winRun$
  397.         CreateIniKeyValue "WIN.INI", "windows", "run", winRun$, cmoOverwrite
  398.     ELSEIF GetListItem(CHECKSTATES$, MSPUB) = "ON" THEN
  399.         selectedWP% = MSPUB
  400.         AddOptFilesToCopyList MSPUB
  401.         CreateIniKeyValue MakePath(GetWindowsDir(),"kpi.ini"), "OLE", "UseInprocHandler", "0", cmoOverwrite
  402.         CreateIniKeyValue MakePath(GetWindowsDir(),"kpi.ini"), "OLE", "Application", "WINWORKS", cmoOverwrite
  403.         CreateIniKeyValue MakePath(GetWindowsDir(),"kpi.ini"), "Templates", "Extension", "PUB", cmoOverwrite
  404.         winRun$ = GetIniKeyString( "WIN.INI", "windows", "run")
  405.         winRun$ = DEST$+"\DSSPTCH.EXE " + winRun$
  406.         CreateIniKeyValue "WIN.INI", "windows", "run", winRun$, cmoOverwrite
  407.     END IF
  408.     
  409.    '' make any directories that we will need
  410.     CreateDir DEST$, cmoNone
  411.     CreateDir MakePath(DEST$, "TEMPLATE"), cmoNone
  412.     CreateDir MakePath( MakePath(DEST$, "TEMPLATE"), "BUILTIN"), cmoNone
  413.     CreateDir MakePath(DEST$, "COLLECT"), cmoNone
  414.     
  415.     '' really, actually copy the files
  416.     CopyFilesInCopyList
  417.     
  418.     '' Prompt user to determine whether auto-launcher should be installed in Startup group
  419. ''    doAutoLaunch% = DoMsgBox("Would you like Kodak Photo Insert to automatically start when a Photo CD is inserted?", "Setup Message", MB_YESNO OR MB_TASKMODAL OR MB_ICONQUESTION)
  420. ''    if doAutoLaunch% = IDYES THEN
  421. ''              winRun$ = GetIniKeyString( "WIN.INI", "windows", "run")
  422. ''              winRun$ = "PCDLNCH.EXE " + winRun$
  423. ''          CreateIniKeyValue "WIN.INI", "windows", "run", winRun$, cmoOverwrite
  424. ''    END IF
  425.     
  426.     '' modify the AUTOEXEC.BAT file to include KPI's path
  427.     '' success% = AddPathToAutoexec( DEST$ )
  428.     
  429.     '' add Kodak Digital Science Photo Insert items to a Program Manager group
  430.     CreateProgmanGroup "Kodak Digital Science", "", cmoNone
  431.     ShowProgmanGroup  "Kodak Digital Science", 1, cmoNone
  432.     CreateProgmanItem "Kodak Digital Science", "Kodak Photo Insert", MakePath(DEST$, "kpi.exe"), "", cmoOverwrite
  433.  
  434. QUIT:
  435.     ON ERROR GOTO ERRQUIT
  436.  
  437.     IF ERR = 0 THEN
  438.     dlg% = EXITSUCCESS
  439.     ELSEIF ERR = STFQUIT THEN
  440.     dlg% = EXITQUIT
  441.     ELSE
  442.     dlg% = EXITFAILURE
  443.     END IF
  444. QUITL1:
  445.     IF dlg% = EXITSUCCESS THEN
  446.         exitMsg$ = "Kodak Photo Insert was successfully installed."
  447.         exitMsg$ = exitMsg$ + " Windows must be rebooted for the changes to take effect. Would you like to restart Windows now?"
  448.         result% = DoMsgBox(exitMsg$, "Setup Message", MB_YESNO+MB_TASKMODAL+MB_ICONQUESTION)
  449.         IF result% = IDYES THEN
  450.             junk% = PostMessage(65535, RebootMsg%, 0, 0)
  451.         ELSE
  452.             dontcare% = DoMsgBox("You must manually restart Windows before using Kodak Photo Insert.", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONSTOP)
  453.         END IF
  454.     ELSE
  455.         sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  456.         IF sz$ = "REACTIVATE" THEN
  457.         GOTO QUITL1
  458.         END IF
  459.         UIPop 1
  460.     ENDIF
  461.     END
  462.  
  463. ERRQUIT:
  464.     i% = DoMsgBox("Setup sources were corrupted. Please call technical support.", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  465.     END
  466.  
  467.  
  468.  
  469. GETPATH:
  470.     SetSymbolValue "EditTextIn", DEST$
  471.     SetSymbolValue "EditFocus", "END"
  472. GETPATHL1:
  473.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  474.  
  475.     IF sz$ = "CONTINUE" THEN
  476.     olddest$ = DEST$
  477.     DEST$ = GetSymbolValue("EditTextOut")
  478.  
  479.     ''Validate new path.
  480.     IF IsDirWritable(DEST$) = 0 THEN
  481.         GOSUB BADPATH
  482.         GOTO GETPATHL1
  483.     END IF
  484.     UIPop 1
  485.  
  486.     ''Truncate display if too long.
  487.     IF LEN(DEST$) > 23 THEN
  488.         ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
  489.     ELSE
  490.         ReplaceListItem DRIVETEXT$, 7, DEST$
  491.     END IF
  492.  
  493.     ''Recalc if path changed.
  494.     IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
  495.         RecalcPath
  496. '            SetDriveStatus
  497.     END IF
  498.  
  499.     olddest$ = ""
  500.     GOTO CUSTINST
  501.     ELSEIF sz$ = "REACTIVATE" THEN
  502.     RecalcPath
  503.     SetDriveStatus
  504.     GOTO GETPATHL1
  505.     ELSEIF sz$ = "EXIT" THEN
  506.     GOSUB ASKQUIT
  507.     GOTO GETPATHL1
  508.     ELSE
  509.     RecalcPath
  510. '        SetDriveStatus
  511.     GOTO GETPATHL1
  512.     END IF
  513.  
  514.  
  515.  
  516. TOOBIG:
  517.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  518.     IF sz$ = "REACTIVATE" THEN
  519.     RecalcPath
  520. '        SetDriveStatus
  521.     GOTO TOOBIG
  522.     END IF
  523.     UIPop 1
  524.     RETURN
  525.  
  526.  
  527.  
  528. BADPATH:
  529.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  530.     IF sz$ = "REACTIVATE" THEN
  531.     RecalcPath
  532. '        SetDriveStatus
  533.     GOTO BADPATH
  534.     END IF
  535.     UIPop 1
  536.     RETURN
  537.  
  538.  
  539.  
  540. ASKQUIT:
  541.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  542.  
  543.     IF sz$ = "EXIT" THEN
  544.     UIPopAll
  545.     ERROR STFQUIT
  546.     ELSEIF sz$ = "REACTIVATE" THEN
  547.     GOTO ASKQUIT
  548.     ELSE
  549.     UIPop 1
  550.     END IF
  551.     RETURN
  552.  
  553.  
  554.  
  555. '**
  556. '** Purpose:
  557. '**     Adds the specified option files to the copy list.
  558. '** Arguments:
  559. '**     ftype%  - type of files to add, one of the following:
  560. '**             WINWORD, WORDPERFECT, WINWORKS
  561. '** Returns:
  562. '**     none.
  563. '*************************************************************************
  564. SUB AddOptFilesToCopyList (ftype%) STATIC
  565.  
  566.     IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
  567.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  568.     IF ftype% = WINWORD THEN
  569.         AddSectionFilesToCopyList "WINWORD", SrcDir$, DEST$
  570.     ELSEIF ftype% = WORDPERFECT THEN
  571.         AddSectionFilesToCopyList "WORDPERFECT", SrcDir$, DEST$
  572.     ELSEIF ftype% = WINWORKS THEN
  573.         AddSectionFilesToCopyList "WINWORKS", SrcDir$, DEST$
  574.     ELSE
  575.         AddSectionFilesToCopyList "MSPUB", SrcDir$, DEST$
  576.     END IF
  577.     SrcDir$ = ""
  578.     END IF
  579. END SUB
  580.  
  581.  
  582. '**
  583. '** Purpose:
  584. '**     Recalculates disk space for the given option files and sets
  585. '**     the status info symbol "StatusItemsText".
  586. '** Arguments:
  587. '**     ftype% - type of files to add, one of the following:
  588. '**             WINWORD, WORDPERFECT, WINWORKS
  589. '** Returns:
  590. '**     none.
  591. '*************************************************************************
  592. SUB RecalcOptFiles (ftype%, fInUse%) STATIC
  593.  
  594.     CursorSave% = ShowWaitCursor()
  595.  
  596.     IF ftype% = WINWORD THEN
  597.     ListSym$ = OPT1NEEDS$
  598.     ELSEIF ftype% = WORDPERFECT THEN
  599.     ListSym$ = OPT2NEEDS$
  600.     ELSEIF ftype% = WINWORKS THEN
  601.     ListSym$ = OPT3NEEDS$
  602.     ELSE
  603.     ListSym$ = OPT4NEEDS$
  604.     END IF
  605.  
  606.     fExtra% = 0
  607.  
  608.     '' If this is the selected word processor, put it in the selection list
  609.     IF fInUse% = 1 THEN
  610.     ClearCopyList
  611.     AddOptFilesToCopyList ftype%
  612.  
  613.     '' If this is the selected word processor, add 2MB for overhead
  614.     ''Add extra cost to Windows drive for ini/progman, etc.
  615. ''        ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  616. ''        ReplaceListItem EXTRACOSTS$, ndrive%, "2097152"
  617. ''        fExtra% = 1
  618.     END IF
  619.  
  620.     StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
  621.  
  622.     cost& = 0
  623.     FOR i% = 1 TO 26 STEP 1
  624.     cost&  = cost& + VAL(GetListItem(ListSym$, i%))
  625.     NEXT i%
  626.     IF cost& < 0 THEN
  627.     cost& = 0
  628.     END IF
  629.  
  630.     ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
  631.  
  632.     IF StillNeed& > 0 THEN
  633.     ReplaceListItem BIGLIST$, ftype%, "YES"
  634.     ELSE
  635.     ReplaceListItem BIGLIST$, ftype%, ""
  636.     END IF
  637.  
  638.     IF fExtra% THEN
  639.     ReplaceListItem EXTRACOSTS$, ndrive%, "0"
  640.     END IF
  641.  
  642.     RestoreCursor CursorSave%
  643.     ListSym$ = ""
  644. END SUB
  645.  
  646.  
  647. '**
  648. '** Purpose:
  649. '**     Recalculates disk space and sets option status info according
  650. '**     to the current destination path.
  651. '** Arguments:
  652. '**     none.
  653. '** Returns:
  654. '**     none.
  655. '*************************************************************************
  656. SUB RecalcPath STATIC
  657.  
  658.     CursorSave% = ShowWaitCursor()
  659.  
  660.     IF GetListItem(CHECKSTATES$, WINWORD) = "ON" THEN
  661.     RecalcOptFiles WORDPERFECT, FALSE
  662.     RecalcOptFiles WINWORKS, FALSE
  663.     RecalcOptFiles WINWORD, TRUE
  664.     RecalcOptFiles MSPUB, FALSE
  665.     END IF
  666.     IF GetListItem(CHECKSTATES$, WORDPERFECT) = "ON" THEN
  667.     RecalcOptFiles WINWORD, FALSE
  668.     RecalcOptFiles WINWORKS, FALSE
  669.     RecalcOptFiles WORDPERFECT, TRUE
  670.     RecalcOptFiles MSPUB, FALSE
  671.     END IF
  672.     IF GetListItem(CHECKSTATES$, WINWORKS) = "ON" THEN
  673.     RecalcOptFiles WINWORD, FALSE
  674.     RecalcOptFiles WORDPERFECT, FALSE
  675.     RecalcOptFiles WINWORKS, TRUE
  676.     RecalcOptFiles MSPUB, FALSE
  677.     END IF
  678.     IF GetListItem(CHECKSTATES$, MSPUB) = "ON" THEN
  679.     RecalcOptFiles WINWORD, FALSE
  680.     RecalcOptFiles WORDPERFECT, FALSE
  681.     RecalcOptFiles WINWORKS, FALSE
  682.     RecalcOptFiles MSPUB, TRUE
  683.     END IF
  684.  
  685.     RestoreCursor CursorSave%
  686. END SUB
  687.  
  688.  
  689. '**
  690. '** Purpose:
  691. '**     Sets drive status info according to latest disk space calcs.
  692. '** Arguments:
  693. '**     none.
  694. '** Returns:
  695. '**     none.
  696. '*************************************************************************
  697. SUB SetDriveStatus STATIC
  698.  
  699.     drive$ = MID$(DEST$, 1, 1)
  700.     ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  701.     cost& = VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%)) + VAL(GetListItem(OPT3NEEDS$, ndrive%))
  702.     IF cost& < 0 THEN
  703.     cost& = 0
  704.     END IF
  705.     free& = GetFreeSpaceForDrive(drive$)
  706.     ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
  707.     ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
  708.     ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
  709.  
  710.     IF drive$ = WINDRIVE$ THEN
  711.     ReplaceListItem DRIVETEXT$, 4, ""
  712.     ReplaceListItem DRIVETEXT$, 5, ""
  713.     ReplaceListItem DRIVETEXT$, 6, ""
  714.     ELSE
  715.     ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  716.     cost& = VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%)) + VAL(GetListItem(OPT3NEEDS$, ndrive%))
  717.     IF cost& = 0 THEN
  718.         ReplaceListItem DRIVETEXT$, 4, ""
  719.         ReplaceListItem DRIVETEXT$, 5, ""
  720.         ReplaceListItem DRIVETEXT$, 6, ""
  721.     ELSE
  722.         free& = GetFreeSpaceForDrive(WINDRIVE$)
  723.         ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
  724.         ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " K"
  725.         ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " K"
  726.     END IF
  727.     END IF
  728. END SUB
  729.  
  730.  
  731. '**
  732. '** Purpose:
  733. '**     Sets drive status info according to latest disk space calcs.
  734. '**     Figures out if we can go ahead with the installation.
  735. '** Arguments:
  736. '**     none.
  737. '** Returns:
  738. '**     1 if installation can take place, 0 if not enough disk space.
  739. '*************************************************************************
  740. FUNCTION GetDriveStatus STATIC AS INTEGER
  741.  
  742.     IF GetListItem(CHECKSTATES$, WINWORD) = "ON" THEN
  743.     RecalcOptFiles WORDPERFECT, FALSE
  744.     RecalcOptFiles WINWORKS, FALSE
  745.     RecalcOptFiles WINWORD, TRUE
  746.     RecalcOptFiles MSPUB, FALSE
  747.     END IF
  748.     IF GetListItem(CHECKSTATES$, WORDPERFECT) = "ON" THEN
  749.     RecalcOptFiles WINWORD, FALSE
  750.     RecalcOptFiles WINWORKS, FALSE
  751.     RecalcOptFiles WORDPERFECT, TRUE
  752.     RecalcOptFiles MSPUB, FALSE
  753.     END IF
  754.     IF GetListItem(CHECKSTATES$, WINWORKS) = "ON" THEN
  755.     RecalcOptFiles WINWORD, FALSE
  756.     RecalcOptFiles WORDPERFECT, FALSE
  757.     RecalcOptFiles WINWORKS, TRUE
  758.     RecalcOptFiles MSPUB, FALSE
  759.     END IF
  760.     IF GetListItem(CHECKSTATES$, MSPUB) = "ON" THEN
  761.     RecalcOptFiles WINWORD, FALSE
  762.     RecalcOptFiles WORDPERFECT, FALSE
  763.     RecalcOptFiles WINWORKS, FALSE
  764.     RecalcOptFiles MSPUB, TRUE
  765.     END IF
  766.  
  767.     drive$ = MID$(DEST$, 1, 1)
  768.     ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  769. ''    cost& = VAL(GetListItem(OPT1NEEDS$, ndrive%))
  770. ''    cost& = GetCopyListCost("", OPT1NEEDS$, "")
  771.     cost& = VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%)) + VAL(GetListItem(OPT3NEEDS$, ndrive%)) + VAL(GetListItem(OPT4NEEDS$, ndrive%))
  772.     free& = GetFreeSpaceForDrive(drive$)
  773.  
  774.     '' Will everything fit?
  775.     IF cost& > free& THEN
  776.     GetDriveStatus = 0
  777.     ELSE
  778.     GetDriveStatus = 1
  779.     END IF
  780. END FUNCTION
  781.  
  782.  
  783. '**
  784. '** Purpose:
  785. '**     Appends a file name to the end of a directory path,
  786. '**     inserting a backslash character as needed.
  787. '** Arguments:
  788. '**     szDir$  - full directory path (with optional ending "\")
  789. '**     szFile$ - filename to append to directory
  790. '** Returns:
  791. '**     Resulting fully qualified path name.
  792. '*************************************************************************
  793. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  794.     IF szDir$ = "" THEN
  795.     MakePath = szFile$
  796.     ELSEIF szFile$ = "" THEN
  797.     MakePath = szDir$
  798.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  799.     MakePath = szDir$ + szFile$
  800.     ELSE
  801.     MakePath = szDir$ + "\" + szFile$
  802.     END IF
  803. END FUNCTION
  804.  
  805.