home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / PROGRAMM / BUILDER.ZIP / TUTOR1.BLD < prev    next >
Text File  |  1992-11-17  |  2KB  |  77 lines

  1. ' First we declare our variables.
  2. ' These are the Longints we will use:
  3. LongInt LI1, LI2, LI3
  4. ' These are the integers we will use:
  5. Integer Int1
  6.  
  7. ' Let's check drive C: for free space, to see if there's enough
  8. ' to install our program.
  9. Put DiskFree "C:" into LI1
  10.  
  11. ' Let's check drive A: for free space, the first step toward
  12. ' seeing how much we're installing.
  13.  
  14. Put DiskFree "A:" into LI2
  15.  
  16. ' Let's see how much space we need on drive C:
  17. Put 360000-LI2 into LI3
  18.  
  19. ' Let's compare what we need to what we've got, and instruct the user
  20. ' if it isn't going to work.
  21. if LI1 < LI3
  22.     Say "You don't have the disk space on Drive C: to ";
  23.     say "install this program."
  24.     say "Please clear at least "; LI3; " bytes from drive C:";
  25.     say " and try again."
  26.     exit 1
  27. end
  28.  
  29. ' Now let's set up our installation menu.
  30. ' This will keep the menu active until {Esc} is pressed or an Exit
  31. ' command is issued
  32. While not cancelled
  33.  
  34. ' simple screen colors.
  35.   Cls bright white on blue
  36. ' Make a DropDown menu called Installation Menu, and give it two choices
  37. ' (items).
  38. ' *** NOTE THIS LINE OF CODE IS DIFFERENT THAN THE EXAMPLE ON PAGE 36 ***
  39.   DropDown "Installation Menu" @10,10
  40.      Item "Begin Installation"
  41. ' This call the subroutine show below.
  42.        FilesON
  43.      Item "Exit Installation"
  44. ' This is a BUILDER  statement telling the program to quit.
  45.        Exit 0
  46.   End
  47. End
  48.  
  49. ' Here's the subroutine being called.
  50. Sub FilesON
  51.  
  52. ' First we check for the exists of our target installation directory
  53.   Int1:= DirExists "C:\Programs"
  54.  
  55. ' If it's there we inform the user and give them a choice.
  56.   If Int1 == 1
  57.      Say @20,1 "Program directory already exists, continues?"
  58.      GetYN
  59. ' *** NOTE THIS LINE OF CODE IS ADDED TO THE EXAMPLE ON PAGE 36 ***
  60.   end
  61. ' If the choice was "Y" then we go on.
  62.   If Errorlevel 1 Run Copy A:\*.* C:\Programs
  63.  
  64. ' If the choice was "N" then we exit with an errorlevel of 1, that
  65. ' we could act upon with another program if we wanted to.
  66.   If Errorlevel 0
  67.      exit 1
  68.  
  69. ' If the target directory didn't exist, we create it.
  70.   end else
  71.      BLDMkDir "C:\Programs"
  72.   end
  73.  
  74. ' And we install by copying the contents of A: to C: in the Programs directory.
  75.   Run Copy A:\*.* C:\Programs
  76. End
  77.