home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 December / PCWKCD1296.iso / demo / elmark / genie / disk1 / genie.ms_ / genie.ms
Text File  |  1995-08-17  |  17KB  |  532 lines

  1. '**************************************************************************
  2. '*                       Genie Setup Script File
  3. '**************************************************************************
  4. ' This script assume:
  5. '               INF file named GENIE.INF
  6. '               Installation of Genie Starter 2.0
  7. '**************************************************************************
  8.  
  9. ''$DEFINE DEBUG  ''Define for script development/debugging
  10.  
  11. '$INCLUDE 'setupapi.inc'
  12. '$INCLUDE 'msdetect.inc'
  13.  
  14. ''Dialog ID's
  15. CONST WELCOME      = 100
  16. CONST ASKQUIT      = 200
  17. CONST DESTPATH     = 300
  18. CONST EXITFAILURE  = 400
  19. CONST CDALREADYUSED = 7100
  20. CONST CDBADFILE    = 7200
  21. CONST CDCONFIRMINFO = 7300
  22. CONST CDGETNAMEORG = 7500
  23. CONST CDBADNAME    = 7700
  24. CONST CDBADORG     = 7800
  25. CONST EXITQUIT     = 600
  26. CONST EXITSUCCESS  = 700
  27. CONST WRITEPROTECT = 750 
  28. CONST OPTIONS      = 800
  29. CONST APPHELP      = 900
  30. CONST CUSTINST     = 6200
  31. CONST TOOBIG       = 6300
  32. CONST BADPATH      = 6400
  33.  
  34. ''Bitmap ID
  35. CONST LOGO         = 1
  36.  
  37. ''File Types
  38. CONST APPFILES     = 1
  39. CONST OPTFILES1    = 2
  40. CONST OPTFILES2    = 3
  41.  
  42.  
  43. GLOBAL DEST$        ''Default destination directory.
  44. GLOBAL SYS$        ''SYSTEM directory.
  45. GLOBAL WINDRIVE$    ''Windows drive letter.
  46. GLOBAL OPT1OPT$     ''Option selection from OptFiles1 option dialog.
  47. GLOBAL OPT2OPT$     ''Option selection from OptFiles2 option dialog.
  48. GLOBAL INI$
  49.  
  50. ''CustInst list symbol names
  51. GLOBAL APPNEEDS$    ''Option list costs per drive
  52. GLOBAL OPT1NEEDS$
  53. GLOBAL OPT2NEEDS$
  54. GLOBAL EXTRACOSTS$  ''List of extra costs to add per drive
  55. GLOBAL BIGLIST$     ''List of option files cost calc results (boolean)
  56.  
  57. ''Dialog list symbol names
  58. GLOBAL CHECKSTATES$
  59. GLOBAL STATUSTEXT$
  60. GLOBAL DRIVETEXT$
  61.  
  62. DECLARE SUB AddOptFilesToCopyList (ftype%)
  63. DECLARE SUB RecalcOptFiles (ftype%)
  64. DECLARE SUB RecalcPath
  65. DECLARE SUB SetDriveStatus
  66. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  67.  
  68. INIT:
  69.     CUIDLL$ = "mscuistf.dll"            ''custom user interface dll
  70.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  71.  
  72.     SetBitmap CUIDLL$, LOGO
  73.     SetTitle "Advantech Genie Starter Setup Program"
  74.     SetAbout "American Advantech Genie Starter", "Version 2.0, ⌐ 1995 American Advantech Corporation"
  75.  
  76.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  77.     IF szInf$ = "" THEN
  78.         szInf$ = GetSymbolValue("STF_CWDDIR") + "GENIE.INF"
  79.     END IF
  80.     ReadInfFile szInf$
  81.  
  82.     WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
  83.     DEST$ = WINDRIVE$ + ":\STARTER"
  84.     SYS$ = GetWindowsDir() + "SYSTEM"
  85.  
  86.     ''CustInst list symbols
  87.     CHECKSTATES$ = "CheckItemsState"
  88.     STATUSTEXT$  = "StatusItemsText"
  89.     DRIVETEXT$   = "DriveStatusText"
  90.     FOR i% = 1 TO 3 STEP 1
  91.         AddListItem CHECKSTATES$, "ON"
  92.     NEXT i%
  93.     FOR i% = 1 TO 3 STEP 1
  94.         AddListItem STATUSTEXT$, ""
  95.     NEXT i%
  96.     FOR i% = 1 TO 7 STEP 1
  97.         AddListItem DRIVETEXT$, ""
  98.     NEXT i%
  99.     ReplaceListItem DRIVETEXT$, 7, DEST$
  100.  
  101.     ''Disk cost list symbols
  102.     APPNEEDS$   = "AppNeeds"
  103.     OPT1NEEDS$  = "Opt1Needs"
  104.     OPT2NEEDS$  = "Opt2Needs"
  105.     EXTRACOSTS$ = "ExtraCosts"
  106.     BIGLIST$    = "BigList"
  107.     FOR i% = 1 TO 3 STEP 1
  108.         AddListItem BIGLIST$, ""
  109.     NEXT i%
  110.     FOR i% = 1 TO 26 STEP 1
  111.         AddListItem EXTRACOSTS$, "0"
  112.     NEXT i%
  113.  
  114.     ''File Option Variables
  115.     OPT1OPT$ = "1"
  116.     OPT2OPT$ = "1"
  117.     INI$ = "2"
  118.  
  119.     RecalcPath
  120.     SetDriveStatus
  121.  
  122. '$IFDEF DEBUG
  123.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  124. '$ENDIF ''DEBUG
  125.  
  126. WELCOME:
  127.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  128.     IF sz$ = "CONTINUE" THEN
  129.         UIPop 1
  130.     ELSE
  131.         GOSUB ASKQUIT
  132.         GOTO WELCOME
  133.     END IF
  134.  
  135.  
  136. CUSTINST:
  137.     sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
  138.  
  139.     IF sz$ = "CONTINUE" THEN
  140.         ''Install only if it will fit.
  141.         FOR i% = 1 TO 3 STEP 1
  142.             IF GetListItem(BIGLIST$, i%) <> "" THEN
  143.                 GOSUB TOOBIG
  144.                 GOTO CUSTINST
  145.             END IF
  146.         NEXT i%
  147.         UIPop 1
  148.         GOTO INSTALL
  149.     ELSEIF sz$ = "PATH" THEN
  150.         GOTO GETPATH
  151.     ELSEIF sz$ = "CHK1" THEN
  152.         RecalcOptFiles APPFILES
  153.         SetDriveStatus
  154.         GOTO CUSTINST
  155.     ELSEIF sz$ = "CHK2" THEN
  156.         RecalcOptFiles OPTFILES1
  157.         SetDriveStatus
  158.         GOTO CUSTINST
  159.     ELSEIF sz$ = "CHK3" THEN
  160.         RecalcOptFiles OPTFILES2
  161.         SetDriveStatus
  162.         GOTO CUSTINST
  163.     ELSEIF sz$ = "BTN2" THEN
  164.         GOTO OPTFILES1
  165.     ELSEIF sz$ = "BTN3" THEN
  166.         GOTO OPTFILES2
  167.     ELSEIF sz$ = "REACTIVATE" THEN
  168.         RecalcPath
  169.         SetDriveStatus
  170.         GOTO CUSTINST
  171.     ELSE
  172.         GOSUB ASKQUIT
  173.         GOTO CUSTINST
  174.     END IF
  175.  
  176. INSTALL:
  177.     ClearCopyList
  178.     AddOptFilesToCopyList APPFILES
  179.     AddOptFilesToCopyList OPTFILES1
  180.     AddOptFilesToCopyList OPTFILES2
  181.     CreateDir DEST$, cmoNone
  182.     CopyFilesInCopyList
  183.     
  184.     IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
  185.         CreateProgmanGroup "Advantech Genie Starter", "", cmoNone
  186.         ShowProgmanGroup  "Advantech Genie Starter", 1, cmoNone
  187.         CreateProgmanItem "Advantech Genie Starter", "Genie Starter", MakePath(DEST$,"geniedm.exe"), "", cmoOverwrite
  188.         CreateProgmanItem "Advantech Genie Starter", "Genie Starter Runtime", MakePath(DEST$,"gwrundm.exe"), "", cmoOverwrite
  189.         CreateProgmanItem "Advantech Genie Starter", "Device Installation", MakePath(DEST$,"devinst.exe"), "", cmoOverwrite
  190.         CreateProgmanItem "Advantech Genie Starter", "Read1st", "notepad.exe "+MakePath(DEST$,"readme.txt"), "", cmoOverwrite
  191.         CreateProgmanItem "Advantech Genie Starter", "GenPad Script Editor", MakePath(DEST$,"genpad.exe"), "", cmoOverwrite
  192.     END IF
  193.  
  194.  
  195. QUIT:
  196.     ON ERROR GOTO ERRQUIT
  197.  
  198.     IF ERR = 0 THEN
  199.         dlg% = EXITSUCCESS
  200.     ELSEIF ERR = STFQUIT THEN
  201.         dlg% = EXITQUIT
  202.     ELSE
  203.         dlg% = EXITFAILURE
  204.     END IF
  205. QUITL1:
  206.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  207.     IF sz$ = "REACTIVATE" THEN
  208.         GOTO QUITL1
  209.     END IF
  210.     UIPop 1
  211.  
  212.     END
  213.  
  214. ERRQUIT:
  215.     i% = DoMsgBox("Setup sources were corrupted, call Advantech.", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  216.     END
  217.  
  218.  
  219.  
  220. GETPATH:
  221.     SetSymbolValue "EditTextIn", DEST$
  222.     SetSymbolValue "EditFocus", "END"
  223. GETPATHL1:
  224.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  225.  
  226.     IF sz$ = "CONTINUE" THEN
  227.         olddest$ = DEST$
  228.         DEST$ = GetSymbolValue("EditTextOut")
  229.  
  230.         ''Validate new path.
  231.         IF IsDirWritable(DEST$) = 0 THEN
  232.             GOSUB BADPATH
  233.             GOTO GETPATHL1
  234.         END IF
  235.         UIPop 1
  236.  
  237.         ''Truncate display if too long.
  238.         IF LEN(DEST$) > 23 THEN
  239.             ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
  240.         ELSE
  241.             ReplaceListItem DRIVETEXT$, 7, DEST$
  242.         END IF
  243.  
  244.         ''Recalc if path changed.
  245.         IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
  246.             RecalcPath
  247.             SetDriveStatus
  248.         END IF
  249.  
  250.         olddest$ = ""
  251.         GOTO CUSTINST
  252.     ELSEIF sz$ = "REACTIVATE" THEN
  253.         RecalcPath
  254.         SetDriveStatus
  255.         GOTO GETPATHL1
  256.     ELSEIF sz$ = "EXIT" THEN
  257.         GOSUB ASKQUIT
  258.         GOTO GETPATHL1
  259.     ELSE
  260.         UIPop 1
  261.         GOTO CUSTINST
  262.     END IF
  263.  
  264.  
  265.  
  266. OPTFILES1:
  267.     SetSymbolValue "RadioDefault", OPT1OPT$
  268. OPT1L1:
  269.     sz$ = UIStartDlg(CUIDLL$, OPTIONS, "FRadioDlgProc", APPHELP, HELPPROC$)
  270.     newopt$ = GetSymbolValue("ButtonChecked")
  271.  
  272.     IF sz$ = "CONTINUE" THEN
  273.         UIPop 1
  274.         IF newopt$ <> OPT1OPT$ THEN
  275.             OPT1OPT$ = newopt$
  276.             RecalcOptFiles OPTFILES1
  277.             SetDriveStatus
  278.         END IF
  279.         newopt$ = ""
  280.         GOTO CUSTINST
  281.     ELSEIF sz$ = "REACTIVATE" THEN
  282.         RecalcPath
  283.         SetDriveStatus
  284.         GOTO OPT1L1
  285.     ELSEIF sz$ = "EXIT" THEN
  286.         GOSUB ASKQUIT
  287.         GOTO OPT1L1
  288.     ELSE
  289.         UIPop 1
  290.         newopt$ = ""
  291.         GOTO CUSTINST
  292.     END IF
  293.  
  294. OPTFILES2:
  295.     SetSymbolValue "RadioDefault", OPT2OPT$
  296. OPT2L1:
  297.     sz$ = UIStartDlg(CUIDLL$, OPTIONS, "FRadioDlgProc", APPHELP, HELPPROC$)
  298.     newopt$ = GetSymbolValue("ButtonChecked")
  299.  
  300.     IF sz$ = "CONTINUE" THEN
  301.         UIPop 1
  302.         IF newopt$ <> OPT2OPT$ THEN
  303.             OPT2OPT$ = newopt$
  304.             RecalcOptFiles OPTFILES2
  305.             SetDriveStatus
  306.         END IF
  307.         newopt$ = ""
  308.         GOTO CUSTINST
  309.     ELSEIF sz$ = "REACTIVATE" THEN
  310.         RecalcPath
  311.         SetDriveStatus
  312.         GOTO OPT2L1
  313.     ELSEIF sz$ = "EXIT" THEN
  314.         GOSUB ASKQUIT
  315.         GOTO OPT2L1
  316.     ELSE
  317.         UIPop 1
  318.         newopt$ = ""
  319.         GOTO CUSTINST
  320.     END IF
  321.  
  322.  
  323. TOOBIG:
  324.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  325.     IF sz$ = "REACTIVATE" THEN
  326.         RecalcPath
  327.         SetDriveStatus
  328.         GOTO TOOBIG
  329.     END IF
  330.     UIPop 1
  331.     RETURN
  332.  
  333. BADPATH:
  334.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  335.     IF sz$ = "REACTIVATE" THEN
  336.         RecalcPath
  337.         SetDriveStatus
  338.         GOTO BADPATH
  339.     END IF
  340.     UIPop 1
  341.     RETURN
  342.  
  343. ASKQUIT:
  344.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  345.  
  346.     IF sz$ = "EXIT" THEN
  347.         UIPopAll
  348.         ERROR STFQUIT
  349.     ELSEIF sz$ = "REACTIVATE" THEN
  350.         GOTO ASKQUIT
  351.     ELSE
  352.         UIPop 1
  353.     END IF
  354.     RETURN
  355.  
  356. '**
  357. '** Purpose:
  358. '**     Adds the specified option files to the copy list.
  359. '** Arguments:
  360. '**     ftype%  - type of files to add, one of the following:
  361. '**             APPFILES, OPTFILES1, OPTFILES2
  362. '** Returns:
  363. '**     none.
  364. '*************************************************************************
  365. SUB AddOptFilesToCopyList (ftype%) STATIC
  366.  
  367.     IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
  368.         SrcDir$ = GetSymbolValue("STF_SRCDIR")
  369.         IF ftype% = APPFILES THEN
  370.             AddSectionFilesToCopyList "AppFiles", SrcDir$, DEST$
  371.             AddSectionKeyFileToCopyList "IniFile", INI$, SrcDir$, GetWindowsDir() 
  372.         ELSEIF ftype% = OPTFILES1 THEN
  373.             'AddSectionFilesToCopyList "OEM", SrcDir$, DEST$
  374.             AddSectionFilesToCopyList "Drivers", SrcDir$, SYS$
  375.         CreateIniKeyValue  MakePath (GetWindowsDir(),"SYSTEM.INI"), "drivers","DAS1","ADDEMO.drv", cmoNone
  376.         CreateIniKeyValue  MakePath (GetWindowsDir(),"SYSTEM.INI"), "drivers","DAS7","ADPCL812.drv", cmoNone
  377.         CreateIniKeyValue  MakePath (GetWindowsDir(),"SYSTEM.INI"), "drivers","DAS8","ADPCL818.drv", cmoNone
  378.         CreateIniKeyValue  MakePath (GetWindowsDir(),"SYSTEM.INI"), "drivers","DAS4","ADPCL711.drv", cmoNone
  379.         CreateIniKeyValue  MakePath (GetWindowsDir(),"SYSTEM.INI"), "drivers","DAS6","ADPCL722.drv", cmoNone
  380.         CreateIniKeyValue  MakePath (GetWindowsDir(),"SYSTEM.INI"), "drivers","DAS5","ADPCL720.drv", cmoNone
  381.         CreateIniKeyValue  MakePath (GetWindowsDir(),"SYSTEM.INI"), "drivers","DAS2","ADADAM.drv", cmoNone
  382.         CreateIniKeyValue  MakePath (GetWindowsDir(),"SYSTEM.INI"), "drivers","DAS3","AD818H", cmoNone
  383.         CreateIniKeyValue  MakePath (GetWindowsDir(),"SYSTEM.INI"), "drivers","DAS3","ADPCL726.drv", cmoNone
  384.         CreateIniKeyValue  MakePath (GetWindowsDir(),"SYSTEM.INI"), "drivers","DAS3","ADPCL816.drv", cmoNone
  385.         CreateIniKeyValue  MakePath (GetWindowsDir(),"SYSTEM.INI"), "drivers","DAS3","ADPCL721.drv", cmoNone
  386.         CreateIniKeyValue  MakePath (GetWindowsDir(),"SYSTEM.INI"), "drivers","DAS3","ADPCL830.drv", cmoNone
  387.         CreateIniKeyValue  MakePath (GetWindowsDir(),"SYSTEM.INI"), "drivers","DAS3","AD818HG.drv", cmoNone
  388.         CreateIniKeyValue  MakePath (GetWindowsDir(),"SYSTEM.INI"), "drivers","DAS3","AD818L.drv", cmoNone
  389.         CreateIniKeyValue  MakePath (GetWindowsDir(),"SYSTEM.INI"), "drivers","DAS3","ADPAD71.drv", cmoNone
  390.            ELSEIF ftype% = OPTFILES2 THEN
  391.             AddSectionFilesToCopyList "Strategy", SrcDir$, DEST$ 
  392.         CreateIniKeyValue "WIN.INI", "Advantech Genie Starter", "GNI",  MakePath (DEST$,"DEMO.GNI"), cmoOverwrite
  393.         END IF
  394.         SrcDir$ = ""
  395.     END IF
  396. END SUB
  397.  
  398. '**
  399. '** Purpose:
  400. '**     Recalculates disk space for the given option files and sets
  401. '**     the status info symbol "StatusItemsText".
  402. '** Arguments:
  403. '**     ftype% - type of files to add, one of the following:
  404. '**             APPFILES, OPTFILES1, OPTFILES2
  405. '** Returns:
  406. '**     none.
  407. '*************************************************************************
  408. SUB RecalcOptFiles (ftype%) STATIC
  409.     CursorSave% = ShowWaitCursor()
  410.     ClearCopyList
  411.     AddOptFilesToCopyList ftype%
  412.  
  413.     fExtra% = 0
  414.     IF ftype% = APPFILES THEN
  415.         ListSym$ = APPNEEDS$
  416.         IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
  417.             ''Add extra cost to Windows drive for ini/progman, etc.
  418.             ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  419.             ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
  420.             fExtra% = 1
  421.         END IF
  422.     ELSEIF ftype% = OPTFILES1 THEN
  423.         ListSym$ = OPT1NEEDS$
  424.     ELSEIF ftype% = OPTFILES2 THEN
  425.         ListSym$ = OPT2NEEDS$
  426.     END IF
  427.  
  428.     StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
  429.  
  430.     cost& = 0
  431.     FOR i% = 1 TO 26 STEP 1
  432.         cost&  = cost& + VAL(GetListItem(ListSym$, i%))
  433.     NEXT i%
  434.     ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
  435.  
  436.     IF StillNeed& > 0 THEN
  437.         ReplaceListItem BIGLIST$, ftype%, "YES"
  438.     ELSE
  439.         ReplaceListItem BIGLIST$, ftype%, ""
  440.     END IF
  441.  
  442.     IF fExtra% THEN
  443.         ReplaceListItem EXTRACOSTS$, ndrive%, "0"
  444.     END IF
  445.     RestoreCursor CursorSave%
  446.     ListSym$ = ""
  447. END SUB
  448.  
  449.  
  450. '**
  451. '** Purpose:
  452. '**     Recalculates disk space and sets option status info according
  453. '**     to the current destination path.
  454. '** Arguments:
  455. '**     none.
  456. '** Returns:
  457. '**     none.
  458. '*************************************************************************
  459. SUB RecalcPath STATIC
  460.  
  461.     CursorSave% = ShowWaitCursor()
  462.  
  463.     RecalcOptFiles APPFILES
  464.     RecalcOptFiles OPTFILES1
  465.     RecalcOptFiles OPTFILES2
  466.  
  467.     RestoreCursor CursorSave%
  468. END SUB
  469.  
  470.  
  471. '**
  472. '** Purpose:
  473. '**     Sets drive status info according to latest disk space calcs.
  474. '** Arguments:
  475. '**     none.
  476. '** Returns:
  477. '**     none.
  478. '*************************************************************************
  479. SUB SetDriveStatus STATIC
  480.  
  481.     drive$ = MID$(DEST$, 1, 1)
  482.     ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  483.     cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) + VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%))
  484.     free& = GetFreeSpaceForDrive(drive$)
  485.     ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
  486.     ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
  487.     ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
  488.  
  489.     IF drive$ = WINDRIVE$ THEN
  490.         ReplaceListItem DRIVETEXT$, 4, ""
  491.         ReplaceListItem DRIVETEXT$, 5, ""
  492.         ReplaceListItem DRIVETEXT$, 6, ""
  493.     ELSE
  494.         ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  495.         cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) + VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%))
  496.         IF cost& = 0 THEN
  497.             ReplaceListItem DRIVETEXT$, 4, ""
  498.             ReplaceListItem DRIVETEXT$, 5, ""
  499.             ReplaceListItem DRIVETEXT$, 6, ""
  500.         ELSE
  501.             free& = GetFreeSpaceForDrive(WINDRIVE$)
  502.             ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
  503.             ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " K"
  504.             ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " K"
  505.         END IF
  506.     END IF
  507. END SUB
  508.  
  509.  
  510. '**
  511. '** Purpose:
  512. '**     Appends a file name to the end of a directory path,
  513. '**     inserting a backslash character as needed.
  514. '** Arguments:
  515. '**     szDir$  - full directory path (with optional ending "\")
  516. '**     szFile$ - filename to append to directory
  517. '** Returns:
  518. '**     Resulting fully qualified path name.
  519. '*************************************************************************
  520. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  521.     IF szDir$ = "" THEN
  522.         MakePath = szFile$
  523.     ELSEIF szFile$ = "" THEN
  524.         MakePath = szDir$
  525.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  526.         MakePath = szDir$ + szFile$
  527.     ELSE
  528.         MakePath = szDir$ + "\" + szFile$
  529.     END IF
  530. END FUNCTION
  531.  
  532.