home *** CD-ROM | disk | FTP | other *** search
/ Color Clipart / CLIPART1.ISO / imager2 / setup.ms_ / setup.ms
Encoding:
Text File  |  1992-11-05  |  18.9 KB  |  684 lines

  1. '**************************************************************************
  2. '*                       MSSetup Toolkit Sample 2
  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 MULTILIST       = 5200
  19. CONST CUSTINST     = 6200
  20. CONST TOOBIG       = 6300
  21. CONST BADPATH      = 6400
  22.  
  23. ''Bitmap ID
  24. CONST LOGO         = 1
  25.  
  26. ''File Types
  27. CONST NUMFILETYPES = 5
  28.  
  29. CONST APPFILES    = 1
  30. CONST FORMATS     = 2
  31. CONST SCANNERS    = 3
  32. CONST PRINTERS    = 4
  33. CONST IMAGES      = 5
  34.  
  35.  
  36. GLOBAL DEST$        ''Default destination directory.
  37. GLOBAL WINDRIVE$    ''Windows drive letter.
  38.  
  39. ''CustInst list symbol names
  40. GLOBAL APPNEEDS$    ''Option list costs per drive
  41. GLOBAL OPT1NEEDS$
  42. GLOBAL OPT2NEEDS$
  43. GLOBAL OPT3NEEDS$
  44. GLOBAL OPT4NEEDS$
  45. GLOBAL EXTRACOSTS$  ''List of extra costs to add per drive
  46. GLOBAL BIGLIST$     ''List of option files cost calc results (boolean)
  47. GLOBAL LISTITEMSIN$
  48. GLOBAL LISTITEMSOUT$
  49. GLOBAL MULTILISTTITLE$
  50. GLOBAL LISTSCANNERS$
  51. GLOBAL LISTPRINTERS$
  52. GLOBAL LISTFORMATS$
  53. GLOBAL LISTIMAGES$
  54. GLOBAL CUIDLL$
  55. GLOBAL SrcDir$
  56. GLOBAL HIFFLDLL$
  57.  
  58. ''Dialog list symbol names
  59. GLOBAL CHECKSTATES$
  60. GLOBAL STATUSTEXT$
  61. GLOBAL DRIVETEXT$
  62.  
  63.  
  64. DECLARE SUB AddOptFilesToCopyList (ftype%)
  65. DECLARE SUB RecalcOptFiles (ftype%)
  66. DECLARE SUB RecalcPath
  67. DECLARE SUB SetDriveStatus
  68. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  69.  
  70. DECLARE SUB CopyList (ListTo$, ListFrom$) 
  71. DECLARE SUB GetListOptions (List$, Section$, Option%)
  72. DECLARE SUB AddOptFiles (List$, Section$, DestDir$)
  73.  
  74.  
  75.  
  76. INIT:
  77.     CUIDLL$ = "mscuistf.dll"            ''custom user interface dll
  78.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  79.  
  80.     SetBitmap CUIDLL$, LOGO
  81.     SetTitle "HALO Desktop Imager Setup"
  82.  
  83.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  84.     IF szInf$ = "" THEN
  85.         szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  86.     END IF
  87.     ReadInfFile szInf$
  88.  
  89.     WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
  90.     DEST$ = WINDRIVE$ + ":\IMAGER2"
  91.  
  92.     ''CustInst list symbols
  93.     CHECKSTATES$ = "CheckItemsState"
  94.     STATUSTEXT$  = "StatusItemsText"
  95.     DRIVETEXT$   = "DriveStatusText"
  96.  
  97. '**************************
  98. '* add any sub sections here
  99. '**************************
  100.     AddListItem "SectionList", "Textures"
  101.     AddListItem "SectionList", "Tutorial"
  102.     AddListItem "SectionList", "Kodak XL 7700"
  103.  
  104.     FOR i% = 1 TO NUMFILETYPES STEP 1
  105.         AddListItem CHECKSTATES$, "ON"
  106.     NEXT i%
  107.     FOR i% = 1 TO NUMFILETYPES STEP 1
  108.         AddListItem STATUSTEXT$, ""
  109.     NEXT i%
  110.     FOR i% = 1 TO 7 STEP 1
  111.         AddListItem DRIVETEXT$, ""
  112.     NEXT i%
  113.     ReplaceListItem DRIVETEXT$, 7, DEST$
  114.  
  115.     ''Disk cost list symbols
  116.     APPNEEDS$   = "AppNeeds"
  117.     OPT1NEEDS$  = "Opt1Needs"
  118.     OPT2NEEDS$  = "Opt2Needs"
  119.     OPT3NEEDS$  = "Opt3Needs"
  120.     OPT4NEEDS$  = "Opt4Needs"
  121.     EXTRACOSTS$ = "ExtraCosts"
  122.     BIGLIST$    = "BigList"
  123.     LISTITEMSIN$ = "ListItemsIn"
  124.     LISTITEMSOUT$ = "ListItemsOut"
  125.     LISTSCANNERS$ = "Scanners"
  126.     LISTPRINTERS$ = "Printers"
  127.     LISTFORMATS$ = "Formats"
  128.     LISTIMAGES$ = "Images"
  129.  
  130.     FOR i% = 1 TO NUMFILETYPES STEP 1
  131.         AddListItem BIGLIST$, ""
  132.     NEXT i%
  133.     FOR i% = 1 TO 26 STEP 1
  134.         AddListItem EXTRACOSTS$, "0"
  135.     NEXT i%
  136.  
  137. '    IF 1 = DoesIniKeyExist("win.ini", "HALO IFF", "LibDir") THEN
  138. '    HIFFLDLL$ = GetIniKeyString("win.ini", "HALO IFF", "DLL")
  139. '    ELSE
  140. '    HIFFLDLL$ = DEST$ + "\HIFFL"
  141.     HIFFLDLL$ = DEST$
  142. '    ENDIF
  143.  
  144.     MakeListFromSectionKeys LISTSCANNERS$, "Scanners"
  145.     MakeListFromSectionKeys LISTPRINTERS$, "Printers"
  146.     MakeListFromSectionKeys LISTFORMATS$, "Formats"
  147.     MakeListFromSectionKeys LISTIMAGES$, "Images"
  148.  
  149.     RecalcPath
  150.     SetDriveStatus
  151.  
  152. '$IFDEF DEBUG
  153.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  154. '$ENDIF ''DEBUG
  155.  
  156.  
  157. CUSTINST:
  158.     sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
  159.  
  160.     IF sz$ = "CONTINUE" THEN
  161.         ''Install only if it will fit.
  162.         FOR i% = 1 TO 3 STEP 1
  163.             IF GetListItem(BIGLIST$, i%) <> "" THEN
  164.                 GOSUB TOOBIG
  165.                 GOTO CUSTINST
  166.             END IF
  167.         NEXT i%
  168.         UIPop 1
  169.         GOTO INSTALL
  170.     ELSEIF sz$ = "PATH" THEN
  171.         GOTO GETPATH
  172.     ELSEIF sz$ = "CHK1" THEN
  173.         RecalcOptFiles APPFILES
  174.         SetDriveStatus
  175.         GOTO CUSTINST
  176.     ELSEIF sz$ = "CHK2" THEN
  177.         RecalcOptFiles FORMATS
  178.         SetDriveStatus
  179.         GOTO CUSTINST
  180.     ELSEIF sz$ = "CHK3" THEN
  181.         RecalcOptFiles SCANNERS
  182.         SetDriveStatus
  183.         GOTO CUSTINST
  184.     ELSEIF sz$ = "CHK4" THEN
  185.         RecalcOptFiles PRINTERS
  186.         SetDriveStatus
  187.         GOTO CUSTINST
  188.     ELSEIF sz$ = "CHK5" THEN
  189.         RecalcOptFiles IMAGES
  190.         SetDriveStatus
  191.         GOTO CUSTINST
  192.     ELSEIF sz$ = "BTN2" THEN
  193.         GOTO DOFORMATS
  194.     ELSEIF sz$ = "BTN3" THEN
  195.         GOTO DOSCANNERS
  196.     ELSEIF sz$ = "BTN4" THEN
  197.         GOTO DOPRINTERS
  198.     ELSEIF sz$ = "BTN5" THEN
  199.         GOTO DOIMAGES
  200.  
  201.     ELSEIF sz$ = "REACTIVATE" THEN
  202.         RecalcPath
  203.         SetDriveStatus
  204.         GOTO CUSTINST
  205.     ELSE
  206.         GOSUB ASKQUIT
  207.         GOTO CUSTINST
  208.     END IF
  209.  
  210.  
  211.  
  212. INSTALL:
  213.     ClearCopyList
  214.     AddOptFilesToCopyList APPFILES
  215.     AddOptFilesToCopyList FORMATS
  216.     AddOptFilesToCopyList SCANNERS
  217.     AddOptFilesToCopyList PRINTERS
  218.     AddOptFilesToCopyList IMAGES
  219.  
  220.     CreateDir DEST$, cmoNone
  221. '    CreateDir HIFFLDLL$, cmoNone
  222.     CopyFilesInCopyList
  223.     
  224.     '********** Create the imager.ini file ********'
  225.     imagerini$ = MakePath(DEST$, "imager.ini")
  226.     ini$ = imagerini$
  227.     tmpini$ = MakePath(GetSymbolValue("STF_CWDDIR"), "hdisetup.ini")
  228.  
  229.     '************ Create HALO Desktop Imager Section *******'
  230.     CreateIniKeyValue ini$, "HALO Desktop Imager", "NativeIFF", "TIFF", cmoNone
  231.     
  232.     '************* Install HIFFL
  233.  
  234.     IF GetListItem(CHECKSTATES$, FORMATS) = "ON" THEN
  235.  
  236.     '************* Create hiffl.ini
  237. '        ini$ = MakePath(DEST$, "foo.INI")
  238. '        ini$ = MakePath(HIFFLDLL$, "hiffl.INI")
  239.     l% = GetListLength("Formats")
  240.  
  241.     
  242.     FOR i% = l% TO 1 STEP -1
  243.         sz$ = GetListItem ("Formats", i%)
  244.             CreateIniKeyValue ini$, "FORMATS", sz$, GetSectionKeyFilename("Formats", sz$) , cmoNone
  245.  
  246.             CreateIniKeyValue ini$, sz$, "LibraryName", GetSectionKeyFilename("Formats", sz$) , cmoNone
  247.             CreateIniKeyValue ini$, sz$, "Name", sz$, cmoNone
  248.             CreateIniKeyValue ini$, sz$, "Path", "", cmoNone
  249.             CreateIniKeyValue ini$, sz$, "Ext", GetIniKeyString(tmpini$, sz$, "Ext"), cmoNone
  250.             CreateIniKeyValue ini$, sz$, "Options", GetIniKeyString(tmpini$, sz$, "Options"), cmoNone
  251.     NEXT i%
  252.     '************* modify win.ini
  253. '    ini$ = "win.ini"
  254. '    CreateIniKeyValue ini$, "HALO IFF", "LibDir", HIFFLDLL$, cmoOverwrite
  255. '    CreateIniKeyValue ini$, "HALO IFF", "INI", HIFFLDLL$, cmoOverwrite
  256.  
  257.         ini$ = ""
  258.     END IF
  259.  
  260.     '************* Install Scanners *************
  261.  
  262.     IF GetListItem(CHECKSTATES$, SCANNERS) = "ON" THEN
  263.         ini$ = imagerini$
  264.     l% = GetListLength("Scanners")
  265.     
  266.     FOR i% = 1 TO l% STEP 1
  267.         sz$ = GetListItem ("Scanners", i%)
  268.             CreateIniKeyValue ini$, "SCANNERS", sz$, GetSectionKeyFilename("Scanners", sz$) , cmoNone
  269.     NEXT i%
  270.  
  271.     IF l% >= 1 THEN
  272.         CreateIniKeyValue ini$, "HALO Desktop Imager", "Scanner", sz$, cmoNone
  273.     ENDIF
  274.         
  275.         ini$ = ""
  276.     END IF
  277.  
  278.     '************* Install Printers *************
  279.  
  280.     IF GetListItem(CHECKSTATES$, PRINTERS) = "ON" THEN
  281.         ini$ = imagerini$
  282.     l% = GetListLength("Printers")
  283.     
  284.     FOR i% = 1 TO l% STEP 1
  285.         sz$ = GetListItem ("Printers", i%)
  286.             CreateIniKeyValue ini$, "PRINTERS", sz$, GetSectionKeyFilename("Printers", sz$) , cmoNone
  287.     NEXT i%
  288.  
  289. '    IF l% >= 1 THEN
  290. '        CreateIniKeyValue ini$, "HALO Desktop Imager", "Scanner", sz$, cmoNone
  291. '    ENDIF
  292.         
  293.         ini$ = ""
  294.     END IF
  295.  
  296.  
  297.     IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
  298.     '************* modify win.ini
  299. '    CreateIniKeyValue "win.ini", "HALO Desktop Imager 2.0", "IniPath", DEST$, cmoOverwrite
  300.         CreateProgmanGroup "Media Cybernetics", "", cmoNone
  301.         ShowProgmanGroup  "Media Cybernetics", 1, cmoNone
  302.         CreateProgmanItem "Media Cybernetics", "HALO Desktop Imager 2.0", MakePath(DEST$,"imager.exe"), "", cmoOverwrite
  303.     CreateProgmanItem "Media Cybernetics", "Screen Capture", MakePath(DEST$,"scrncapt.exe"), "", cmoOverwrite
  304.         CreateProgmanItem "Media Cybernetics", "Readme", "notepad.exe "+MakePath(DEST$,"readme.doc"), "", cmoOverwrite
  305.     ENDIF
  306.  
  307.  
  308. QUIT:
  309.     ON ERROR GOTO ERRQUIT
  310.  
  311.     IF ERR = 0 THEN
  312.         dlg% = EXITSUCCESS
  313.     ELSEIF ERR = STFQUIT THEN
  314.         dlg% = EXITQUIT
  315.     ELSE
  316.         dlg% = EXITFAILURE
  317.     END IF
  318. QUITL1:
  319.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  320.     IF sz$ = "REACTIVATE" THEN
  321.         GOTO QUITL1
  322.     END IF
  323.     UIPop 1
  324.  
  325.     END
  326.  
  327. ERRQUIT:
  328.     i% = DoMsgBox("Setup sources were corrupted, call Media Cybernetics Tecnical Support", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  329.     END
  330.  
  331.  
  332.  
  333. GETPATH:
  334.     SetSymbolValue "EditTextIn", DEST$
  335.     SetSymbolValue "EditFocus", "END"
  336. GETPATHL1:
  337.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  338.  
  339.     IF sz$ = "CONTINUE" THEN
  340.         olddest$ = DEST$
  341.         DEST$ = GetSymbolValue("EditTextOut")
  342.  
  343.         ''Validate new path.
  344.         IF IsDirWritable(DEST$) = 0 THEN
  345.             GOSUB BADPATH
  346.             GOTO GETPATHL1
  347.         END IF
  348.         UIPop 1
  349.  
  350.         ''Truncate display if too long.
  351.         IF LEN(DEST$) > 23 THEN
  352.             ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
  353.         ELSE
  354.             ReplaceListItem DRIVETEXT$, 7, DEST$
  355.         END IF
  356.  
  357.         ''Recalc if path changed.
  358.         IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
  359.             RecalcPath
  360.             SetDriveStatus
  361.         END IF
  362.  
  363.         olddest$ = ""
  364.         GOTO CUSTINST
  365.     ELSEIF sz$ = "REACTIVATE" THEN
  366.         RecalcPath
  367.         SetDriveStatus
  368.         GOTO GETPATHL1
  369.     ELSEIF sz$ = "EXIT" THEN
  370.         GOSUB ASKQUIT
  371.         GOTO GETPATHL1
  372.     ELSE
  373.         UIPop 1
  374.         GOTO CUSTINST
  375.     END IF
  376.  
  377.  
  378.  
  379. DOSCANNERS:
  380.     SetSymbolValue "MultiListHeader", "Select the scanners you will be using with the HALO Desktop Imager"
  381.     GetListOptions LISTSCANNERS$, "Scanners", SCANNERS
  382.     GOTO CUSTINST
  383.     
  384. DOFORMATS:
  385.     SetSymbolValue "MultiListHeader", "Select the formats of the image files you will be using with the HALO Desktop Imager"
  386.     GetListOptions LISTFORMATS$, "Formats", FORMATS
  387.     j% = GetListLength(LISTFORMATS$)
  388.     IF j% < 1 THEN
  389.         j% = DoMsgBox("You must select at least one format to install", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  390.         GOTO DOFORMATS
  391.     ENDIF
  392.  
  393.     GOTO CUSTINST
  394.  
  395. DOPRINTERS:
  396.     SetSymbolValue "MultiListHeader", "Select any special printers you will be using with the HALO Desktop Imager"
  397.     GetListOptions LISTPRINTERS$, "Printers", PRINTERS
  398.     GOTO CUSTINST
  399.  
  400. DOIMAGES:
  401.     SetSymbolValue "MultiListHeader", "Select the smaple images you would like to install"
  402.     GetListOptions LISTIMAGES$, "Images", IMAGES
  403.     GOTO CUSTINST
  404.  
  405. TOOBIG:
  406.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  407.     IF sz$ = "REACTIVATE" THEN
  408.         RecalcPath
  409.         SetDriveStatus
  410.         GOTO TOOBIG
  411.     END IF
  412.     UIPop 1
  413.     RETURN
  414.  
  415.  
  416.  
  417. BADPATH:
  418.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  419.     IF sz$ = "REACTIVATE" THEN
  420.         RecalcPath
  421.         SetDriveStatus
  422.         GOTO BADPATH
  423.     END IF
  424.     UIPop 1
  425.     RETURN
  426.  
  427.  
  428.  
  429. ASKQUIT:
  430.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  431.  
  432.     IF sz$ = "EXIT" THEN
  433.         UIPopAll
  434.         ERROR STFQUIT
  435.     ELSEIF sz$ = "REACTIVATE" THEN
  436.         GOTO ASKQUIT
  437.     ELSE
  438.         UIPop 1
  439.     END IF
  440.     RETURN
  441.  
  442.  
  443. '*
  444. '* GetListOptions:
  445. '*    Invoke the multi list options dialog for a specific list
  446. '*    of options
  447. '*
  448. SUB GetListOptions (List$, Section$, Option%) STATIC
  449.  
  450.     SetSymbolValue "MultiListTitle", "Install " + List$
  451.  
  452.     MakeListFromSectionKeys LISTITEMSIN$, Section$
  453.     CopyList LISTITEMSOUT$, List$
  454.  
  455. GLO1:
  456.     sz$ = UIStartDlg(CUIDLL$, MULTILIST, "FMultiDlgProc", APPHELP, HELPPROC$)
  457.  
  458.     IF sz$ = "CONTINUE" THEN
  459.     UIPop 1
  460.     CopyList List$, LISTITEMSOUT$
  461.         RecalcOptFiles Option%
  462.  
  463.     ELSEIF sz$ = "REACTIVATE" THEN
  464.         RecalcPath
  465.         SetDriveStatus
  466.         GOTO GLO1
  467. '    ELSEIF sz$ = "EXIT" THEN
  468. '        GOSUB ASKQUIT
  469. '        GOTO GLO1
  470.     ELSE
  471.         UIPop 1
  472.         newopt$ = ""
  473.     END IF
  474.  
  475. END SUB 
  476.  
  477.  
  478. SUB CopyList (ListTo$, ListFrom$) STATIC
  479.  
  480.     l% = GetListLength ( ListFrom$ )
  481.     SetSymbolValue ListTo$, ""
  482.  
  483.     FOR i% = 1 TO l% STEP 1
  484.     sz$ = GetListItem (ListFrom$, i%)
  485.         AddListItem ListTo$, sz$
  486.     NEXT i%
  487. END SUB
  488.  
  489.  
  490.  
  491. '**
  492. '** Purpose:
  493. '**     Adds the specified option files to the copy list.
  494. '** Arguments:
  495. '**     ftype%  - type of files to add, one of the following:
  496. '**             APPFILES, SCANNERS, FORMATS
  497. '** Returns:
  498. '**     none.
  499. '*************************************************************************
  500. SUB AddOptFilesToCopyList (ftype%) STATIC
  501.  
  502.     IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
  503.         SrcDir$ = GetSymbolValue("STF_SRCDIR")
  504.         IF ftype% = APPFILES THEN
  505.             AddSectionFilesToCopyList "HDIFiles", SrcDir$, DEST$
  506.  
  507.         ELSEIF ftype% = SCANNERS THEN
  508.         AddOptFiles LISTSCANNERS$, "Scanners", DEST$
  509.  
  510.         ELSEIF ftype% = FORMATS THEN
  511. '        AddOptFiles LISTFORMATS$, "Formats", HIFFLDLL$
  512.         AddOptFiles LISTFORMATS$, "Formats", DEST$
  513.  
  514.         ELSEIF ftype% = PRINTERS THEN
  515.         AddOptFiles LISTPRINTERS$, "Printers", DEST$
  516.  
  517.         ELSEIF ftype% = IMAGES THEN
  518.         AddOptFiles LISTIMAGES$, "Images", DEST$
  519.  
  520.         END IF
  521.         SrcDir$ = ""
  522.     END IF
  523. END SUB
  524.  
  525. SUB AddOptFiles( List$, Section$, DestDir$) STATIC
  526.  
  527.     l% = GetListLength ( List$ )
  528.  
  529.     FOR i% = 1 TO l% STEP 1
  530.         sz$ = GetListItem (List$, i%)
  531.            AddSectionKeyFileToCopyList Section$, sz$, SrcDir$, DestDir$
  532.         m% = GetListLength ( "SectionList")
  533.         FOR j% = 1 to m% STEP 1
  534.         sz2$ = GetListItem ("SectionList", j%)
  535.         IF sz2$ = sz$ THEN
  536.             AddSectionFilesToCopyList sz$, SrcDir$, DestDir$
  537.         ENDIF
  538.         NEXT j%
  539.     NEXT i%
  540.  
  541. END SUB
  542.  
  543. '**
  544. '** Purpose:
  545. '**     Recalculates disk space for the given option files and sets
  546. '**     the status info symbol "StatusItemsText".
  547. '** Arguments:
  548. '**     ftype% - type of files to add, one of the following:
  549. '**             APPFILES, SCANNERS, FORMATS
  550. '** Returns:
  551. '**     none.
  552. '*************************************************************************
  553. SUB RecalcOptFiles (ftype%) STATIC
  554.     CursorSave% = ShowWaitCursor()
  555.     ClearCopyList
  556.     AddOptFilesToCopyList ftype%
  557.  
  558.     fExtra% = 0
  559.     IF ftype% = APPFILES THEN
  560.         ListSym$ = APPNEEDS$
  561.         IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
  562.             ''Add extra cost to Windows drive for ini/progman, etc.
  563.             ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  564.             ReplaceListItem EXTRACOSTS$, ndrive%, "2048"
  565.             fExtra% = 1
  566.         END IF
  567.     ELSEIF ftype% = FORMATS THEN
  568.         ListSym$ = OPT1NEEDS$
  569.     ELSEIF ftype% = SCANNERS THEN
  570.         ListSym$ = OPT2NEEDS$
  571.     ELSEIF ftype% = PRINTERS THEN
  572.         ListSym$ = OPT3NEEDS$
  573.     ELSEIF ftype% = IMAGES THEN
  574.         ListSym$ = OPT4NEEDS$
  575.     END IF
  576.  
  577.     StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
  578.  
  579.     cost& = 0
  580.     FOR i% = 1 TO 26 STEP 1
  581.         cost&  = cost& + VAL(GetListItem(ListSym$, i%))
  582.     NEXT i%
  583.     ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
  584.  
  585.     IF StillNeed& > 0 THEN
  586.         ReplaceListItem BIGLIST$, ftype%, "YES"
  587.     ELSE
  588.         ReplaceListItem BIGLIST$, ftype%, ""
  589.     END IF
  590.  
  591.     IF fExtra% THEN
  592.         ReplaceListItem EXTRACOSTS$, ndrive%, "0"
  593.     END IF
  594.     RestoreCursor CursorSave%
  595.     ListSym$ = ""
  596. END SUB
  597.  
  598.  
  599. '**
  600. '** Purpose:
  601. '**     Recalculates disk space and sets option status info according
  602. '**     to the current destination path.
  603. '** Arguments:
  604. '**     none.
  605. '** Returns:
  606. '**     none.
  607. '*************************************************************************
  608. SUB RecalcPath STATIC
  609.  
  610.     CursorSave% = ShowWaitCursor()
  611.  
  612.     RecalcOptFiles APPFILES
  613.     RecalcOptFiles SCANNERS
  614.     RecalcOptFiles FORMATS
  615.     RecalcOptFiles PRINTERS
  616.     RecalcOptFiles IMAGES
  617.  
  618.     RestoreCursor CursorSave%
  619. END SUB
  620.  
  621.  
  622. '**
  623. '** Purpose:
  624. '**     Sets drive status info according to latest disk space calcs.
  625. '** Arguments:
  626. '**     none.
  627. '** Returns:
  628. '**     none.
  629. '*************************************************************************
  630. SUB SetDriveStatus STATIC
  631.  
  632.     drive$ = MID$(DEST$, 1, 1)
  633.     ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  634.     cost& = VAL(GetListItem(APPNEEDS$, ndrive%))  + VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%)) + VAL(GetListItem(OPT3NEEDS$, ndrive%)) + VAL(GetListItem(OPT4NEEDS$, ndrive%)) 
  635.  
  636.     free& = GetFreeSpaceForDrive(drive$)
  637.     ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
  638.     ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
  639.     ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
  640.  
  641.     IF drive$ = WINDRIVE$ THEN
  642.         ReplaceListItem DRIVETEXT$, 4, ""
  643.         ReplaceListItem DRIVETEXT$, 5, ""
  644.         ReplaceListItem DRIVETEXT$, 6, ""
  645.     ELSE
  646.         ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  647.         cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) + VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%)) + VAL(GetListItem(OPT3NEEDS$, ndrive%)) + VAL(GetListItem(OPT4NEEDS$, ndrive%))
  648.         IF cost& = 0 THEN
  649.             ReplaceListItem DRIVETEXT$, 4, ""
  650.             ReplaceListItem DRIVETEXT$, 5, ""
  651.             ReplaceListItem DRIVETEXT$, 6, ""
  652.         ELSE
  653.             free& = GetFreeSpaceForDrive(WINDRIVE$)
  654.             ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
  655.             ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " K"
  656.             ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " K"
  657.         END IF
  658.     END IF
  659. END SUB
  660.  
  661.  
  662. '**
  663. '** Purpose:
  664. '**     Appends a file name to the end of a directory path,
  665. '**     inserting a backslash character as needed.
  666. '** Arguments:
  667. '**     szDir$  - full directory path (with optional ending "\")
  668. '**     szFile$ - filename to append to directory
  669. '** Returns:
  670. '**     Resulting fully qualified path name.
  671. '*************************************************************************
  672. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  673.     IF szDir$ = "" THEN
  674.         MakePath = szFile$
  675.     ELSEIF szFile$ = "" THEN
  676.         MakePath = szDir$
  677.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  678.         MakePath = szDir$ + szFile$
  679.     ELSE
  680.         MakePath = szDir$ + "\" + szFile$
  681.     END IF
  682. END FUNCTION
  683.  
  684.