home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / BBS / FLYDIR.ZIP / FLYDIR.DOC < prev    next >
Text File  |  1994-12-29  |  6KB  |  143 lines

  1. ============================================================================
  2. This PPE is designed to allow the Sysop to automatically generate
  3. PCBoard-format DIR files on-the-fly from a DIR listing.  It's designed to
  4. be run whenever new files are copied into directories, and will list all
  5. available files, their size and the file date.  At the end of the file it
  6. will list a total number of files and a total size for all files contained
  7. within the directory.
  8. ============================================================================
  9.  
  10. INSTALLATION:
  11.  
  12. To install, first create a directory called \PCB\PPE\FLYDIR and move the
  13. files you unzipped from this archive into it.  Then go into PCBSetup and to
  14. the conference where you'd like this to work.  Edit the DIR.LST file and
  15. make it something like this:
  16.  
  17.                                DIR.LST Editor
  18.                                  Main Board
  19.  
  20.        DIR Text File Name & Path       Hard Disk Subdirectory        Sort
  21.        ═════════════════════════       ══════════════════════        ════
  22.   1)   C:\PPL\FLYDIR\DIR1              G:\DEMO\                        1
  23.   2)   C:\PPL\FLYDIR\DIR2              G:\145TEXT\                     1
  24.   3)   C:\PPL\FLYDIR\DIR3              G:\142TEXT\                     1
  25.   4)   C:\PPL\FLYDIR\DIR4              G:\DOORGAME\                    1
  26.   5)   C:\PPL\FLYDIR\DIR5              G:\READERS\                     1
  27.  
  28. This is all pretty standard.  Where the big changes come in is in the DIR
  29. files themselves.  Instead of using PCBFiler to edit them and create them,
  30. use any standard text editor and make them look like this:
  31.  
  32. !c:\pcb\ppe\flydir\flydir.ppe 1
  33.  
  34. This is the only line you need to have in the file.  The number following
  35. the name of the PPE needs to reflect the DIR number.  In other words, DIR1
  36. is shown above, DIR2 would look like this:
  37.  
  38. !c:\pcb\ppe\flydir\flydir.ppe 2
  39.  
  40. and so on, through all of your DIR files.  Once you've got this done,
  41. that's all it takes.  When one of your callers requests a file list, it
  42. will be built on-the-fly, and will show all files you have in the
  43. directory.  This will not use any FILE_ID.DIZ descriptions, it will only
  44. display the file name, file size and file date.  Since it's created when
  45. it's asked for, it's always up to date, and you never have to maintain
  46. anything.
  47.  
  48. Since this is not a DIR file, PCBoard can't colorize it on the fly.  If you
  49. want the file information to be displayed in color, you'll have to enter
  50. the color codes into the PPE and recompile it.  I left it in black and
  51. white, but the source code is in there, and you're free to change it any
  52. way you'd like.  IF YOU MODIFY THIS SOURCE CODE AND WISH TO UPLOAD IT TO
  53. SALT AIR DO NOT UPLOAD IT AS A LATER RELEASE OF THIS PPE - UPLOAD IT AS
  54. YOUR PACKAGE.   You may give me credit for the base code, if you wish, but
  55. I don't want to be called and asked why your version of this isn't working
  56. as advertised.
  57.  
  58.  
  59. ============================================================================
  60.  
  61. EXPLAINING THE CODE:
  62.  
  63. -Declare the variables:
  64.  
  65. String Files,LSTFile,DIRFile,DIRSub,CNames,Found,Desc,Line
  66. Integer i,Temp,Sort,Dir
  67. Int C_Size
  68.  
  69.  
  70. -Find out the location of the CNAMES file by reading the PCBOARD.DAT file.
  71.  
  72. CNames = ReadLine(PCBDat(),31)+".@@@"
  73.  
  74.  
  75. -Open the CNAMES.@@@ file and read the location of the DIR.LST file from
  76. -it.  The CNAMES.@@@ file is faster to read, because it is a binary file,
  77. -and retreiving information from a binary file is faster than retrieving it
  78. -from an ASCII file.
  79.  
  80. FOpen 1,CNames,O_RD,S_DN
  81. FRead 1,C_Size,2
  82. FSeek 1,((C_Size*CurConf())+484),Seek_Set
  83. FRead 1,LSTFile,33
  84. FClose 1
  85.  
  86. -Open the DIR.LST file and read in the information for the first DIR file
  87. -and associated subdirectory.  This PPE uses the FINDFIRST() and FINDNEXT()
  88. -functions to get a list of files in the directory.  By using the FILEINF()
  89. -function, you get the file size and date.
  90.  
  91. FOpen 1,LSTFile,O_RD,S_DN
  92.  
  93.  
  94. -Search through the DIR file to the correct position for this request and
  95. -read in the information for subdirectory and description.  The other is
  96. -read in just for convenience's sake.
  97.  
  98. FSeek 1,((Dir-1)*96),Seek_Set
  99.   FRead 1,DIRFile,30
  100.   FRead 1,DIRSub,30
  101.   FRead 1,Desc,35
  102.  
  103.  
  104. -Because when we read information in from a binary file, it contains ALL
  105. -the information - including spaces - it's necessary to strip off the spaces
  106. -from the end of the line.  The STRIP() function is designed for that.  It
  107. -will strip out any occurance of a character, anywhere it appears in a
  108. -string.
  109.  
  110.   DIRSub = Strip(DIRSub," ")
  111.  
  112.  
  113. -This line is where we find the first file in the directory.  For reasons
  114. unknown to lowly non-programmers like me, it takes a different function to
  115. find the first file than it takes to find every subsequent file.  This
  116. works, the programming department has told me it has to be like this - who
  117. am I to argue?
  118.  
  119.   Found = FindFirst(DIRSub+"*.*")
  120.  
  121.  
  122. -The line must be formatted properly as a PCBoard-style DIR file in order
  123. -for things like the FLAG PPE (allows flagging a file by using the space bar
  124. -available on Salt Air as FLAG32.ZIP).  This line formats the information
  125. -retrieved and prepares it to be inserted into the new DIR file.
  126.  
  127.   Line = Left(Found,12)+Right(String(FileInf(DIRSub+Found,4)),9)+Space(2)+String(FileInf(DIRSub+Found,2))
  128.  
  129.  
  130. -Once we've used the FINDFIRST() function, we then use the FINDNEXT()
  131. -function for all subsequent files.  As long as FINDNEXT returns file name
  132. -information (while it's not equal to "", or blank) we'll continue in this
  133. -loop, constantly getting new file names and printing the formatted text to
  134. -the screen.
  135.  
  136.   While (Found <> "") do
  137.     Found = FindNext()
  138.     Line = Left(Found,12)+Right(String(FileInf(DIRSub+Found,4)),9)+Space(2)+String(FileInf(DIRSub+Found,2))
  139.     If (Found <> "") PrintLn Line
  140.   Endwhile
  141.  
  142. -This is the end of the code.
  143.