home *** CD-ROM | disk | FTP | other *** search
/ Carsten's PPE Collection / Carstens_PPE_Collection_2007.zip / S / SRCH200.ZIP / SEARCH.SCR < prev    next >
Text File  |  1993-03-24  |  13KB  |  312 lines

  1. ; *****************************************************************
  2. ; *                                                               *
  3. ; *                     S E A R C H   V 1 . 0                     *
  4. ; *       Comprehensive search "command" for PCBoard V15.0        *
  5. ; *                                                               *
  6. ; *               Written in "The" language for PCBoard           *
  7. ; *                                                               *
  8. ; *                    Designed By:  Steve Catmull                *
  9. ; *                                                               *
  10. ; *                    Began development: 02-06-93                *
  11. ; *                                                               *
  12. ; *****************************************************************
  13. ;
  14. ; This command enables users to search either the message base,
  15. ; or the file areas for specific text.
  16. ;
  17. STRING srch_slct             ; Used to store choice of messages/files
  18. STRING fsrch_slct            ; Search by filename or description.
  19. STRING filename              ; File_Srch - filename(s) to search
  20. STRING directories           ; File_Srch - Directories to search
  21. DATE   file_date             ; File_Srch - Scan for files after this date
  22. STRING flag_match            ; File_Srch - Download Flagged Files?
  23. STRING file_chars            ; Valid characters for a filename
  24. STRING temp,temp2            ; For whatever.
  25. STRING zsearch, nozsearch    ; For (Z)ippy type scans.
  26. STRING z_command,l_command   ; Holds the actual strings that are stuff to keyb.
  27.  
  28. ; -----------------------------------------------------------------------
  29. ; Initialize Variables
  30. ; -----------------------------------------------------------------------
  31.  
  32. GETUSER
  33. flag_match="No"
  34. file_chars="!$%&'()*+-./0123456789:;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿αß"
  35. file_date = 000000
  36. directories="A"
  37.  
  38.  
  39. ; -----------------------------------------------------------------------
  40. ;  Ask if user wishes to search through message base or file areas
  41. ; -----------------------------------------------------------------------
  42.  
  43. ;CLS
  44. ;PRINTLN "@X20┌──────────────────────────────────@X2A┐@X07"
  45. ;PRINTLN "@X20│ @X2FSearch File Directories          @X2A│@X07"
  46. ;PRINTLN "@X20└@X2A──────────────────────────────────┘@X07"
  47. ;PRINTLN
  48. ;PRINTLN "   @X0E(@X0F1@X0E) File descriptions@X07"
  49. ;PRINTLN "   @X0E(@X0F2@X0E) Message bases@X07"
  50. ;PRINTLN ""
  51. ;INPUTSTR "Which area would you like to search for text (1-2)",srch_slct,0Ah,1,"12",270
  52. ;IF (srch_slct = "1") GOTO File_Srch
  53. ;GOTO Msg_Srch
  54.  
  55.  
  56. ; -----------------------------------------------------------------------
  57. ;  User informed us they wish to search the file areas.  Now ask to see
  58. ;  if they wish to search by filename or description
  59. ; -----------------------------------------------------------------------
  60.  
  61. :File_Srch
  62. CLS
  63. PRINTLN "@X20┌────────────────────────────────────@X2A┐@X07"
  64. PRINTLN "@X20│@X2F Search File Areas                  @X2A│@X07"
  65. PRINTLN "@X20└@X2A────────────────────────────────────┘@X07"
  66. PRINTLN
  67. PRINTLN "   @X0E(@X0F1@X0E) Locate by filename@X07"
  68. PRINTLN "   @X0E(@X0F2@X0E) Find text in any description@X07"
  69. PRINTLN "   @X0E(@X0FQ@X0E) Quit Search@X07"
  70. PRINTLN
  71. INPUTSTR "Which would you like to search through (1-2)",fsrch_slct,0Ah,1,"12Q",270
  72. IF (fsrch_slct = "1") GOTO LFile_Srch
  73. IF (fsrch_slct = "2") GOTO ZFile_Srch
  74. IF (fsrch_slct = "" ) END
  75. IF (fsrch_slct = "Q") END
  76. PRINTLN
  77. PRINTLN "@X0CInvalid selection entered.@X07"
  78. PRINTLN
  79. PRINTLN "@QOFF@@MORE@@QON@"
  80. GOTO File_Srch
  81.  
  82.  
  83. ; -----------------------------------------------------------------------
  84. ; User choose to locate by filename.  Display current search criteria and
  85. ; display options available to user.
  86. ; -----------------------------------------------------------------------
  87.  
  88. :LFile_Srch
  89.  
  90. fsrch_slct = ""
  91. GOSUB LSearch_Params
  92. INPUTSTR "@X0AChange (@X0FF@X0A)ilename (@X0FD@X0A)irectories (@X0FN@X0A)ew date F(@X00@X0FL@XFF)ag (@X0FQ@X0A)uit (@X0FS@X0A)earch",fsrch_slct,0Ah,1,"FDNLSQ",270
  93. IF (fsrch_slct = "F") GOSUB Change_File
  94. IF (fsrch_slct = "D") GOSUB Change_Dirs
  95. IF (fsrch_slct = "N") GOSUB Change_Date
  96. IF (fsrch_slct = "L") GOSUB  Change_Flagged
  97. IF (fsrch_slct = "S") GOTO  GoFile_Search
  98. IF (fsrch_slct = "") GOTO File_Srch
  99. IF (fsrch_slct = "Q") END
  100. GOTO LFile_Srch
  101. END
  102.  
  103.  
  104. ; -----------------------------------------------------------------------
  105. ; User has selected to modify the filename to search for
  106. ; -----------------------------------------------------------------------
  107.  
  108. :Change_File
  109. IF (!U_EXPERT) DISPFILE PPEPATH()+"LOCATE.SRC",1
  110. INPUTSTR "Enter filename to search for",filename,0Ah,12,file_chars,170
  111. RETURN
  112.  
  113.  
  114. ; --------------------------------------------------------------------------
  115. ; User has selected to change directories to search for.  
  116. ; --------------------------------------------------------------------------
  117.  
  118. :Change_Dirs
  119. IF (!U_EXPERT) DISPFILE PPEPATH()+"DIRS.SRC",1
  120. INPUTSTR "Enter directories to include in your search",directories,0Ah,25," 0123456789AUP-,",170
  121. RETURN
  122.  
  123.  
  124. ; --------------------------------------------------------------------------
  125. ; User has selected to restrict search to files dated equal to of after date
  126. ; --------------------------------------------------------------------------
  127.  
  128. :Change_Date
  129. PRINTLN
  130. PRINTLN "@X03If you @X00@X0Bdo not want to search@XFF for files @X0Bbased on the date@XFF of the file then"
  131. PRINTLN "enter a date of @X0F0@XFF.  This will exclude the date from the search."
  132. PRINTLN
  133. INPUTDATE "Enter new date to begin searching for files",file_date,0Ah
  134. RETURN
  135.  
  136.  
  137. ; --------------------------------------------------------------------------
  138. ; User has selected to toggled flag status.  Files found in search may be
  139. ; selected to be flagged for download.
  140. ; --------------------------------------------------------------------------
  141.  
  142. :Change_Flagged
  143. temp = flag_match
  144. IF (temp = "Yes") flag_match = "No"
  145. IF (temp = "No") flag_match = "Yes"
  146. RETURN
  147.        
  148.  
  149. ; --------------------------------------------------------------------------
  150. ; Go ahead and stuff the keyboard with the search string user has created.     
  151. ; --------------------------------------------------------------------------
  152.  
  153. :GoFile_Search
  154. GOSUB CRUNCH_DATE
  155. GOSUB Build_L
  156. LOG "SEARCH: "+l_command,0
  157. IF (l_command = "No search created yet") END
  158. KBDSTUFF l_command
  159. END
  160.  
  161.  
  162. ; --------------------------------------------------------------------------
  163. ;
  164. ; --------------------------------------------------------------------------
  165.  
  166. :ZFile_Srch
  167. fsrch_slct = ""
  168. GOSUB zsearch_Params
  169. INPUTSTR "@X0AChange (@X0FM@X0A)atching (@X0FE@X0A)xclude (@X0FN@X0A)ew date (@X0FF@X0A)lag (@X0FD@X0A)irs (@X0FQ@X0A)uit (@X0FS@X0A)earch",fsrch_slct,0Ah,1,"MENFDQS",270
  170. IF (fsrch_slct = "M") GOSUB Z_MATCH
  171. IF (fsrch_slct = "E") GOSUB Z_EXCLUDE
  172. IF (fsrch_slct = "N") GOSUB Change_Date
  173. IF (fsrch_slct = "F") GOSUB Change_Flagged
  174. IF (fsrch_slct = "D") GOSUB Change_Dirs
  175. IF (fsrch_slct = "S") GOTO Z_Search
  176. IF (fsrch_slct = "") GOTO File_Srch
  177. IF (fsrch_slct = "Q") END
  178. GOTO ZFile_Srch
  179. END
  180.  
  181.  
  182. ; --------------------------------------------------------------------------
  183. ;
  184. ; --------------------------------------------------------------------------
  185.  
  186. :Z_Search
  187. GOSUB Build_Z
  188. LOG "SEARCH: "+z_command,0
  189. IF (z_command = "No search created yet") END
  190. KBDSTUFF z_command
  191. END
  192.  
  193.  
  194. ; --------------------------------------------------------------------------
  195. ;  Build both the display and the actual search string for the (Z) command. 
  196. ; --------------------------------------------------------------------------
  197.  
  198. :Build_Z
  199. IF (!(LEFT(zsearch,1)="(" & RIGHT(zsearch,1)=")") & (INSTR(zsearch,"&")<>0) | (INSTR(zsearch,"|")<> 0)) zsearch = "("+zsearch+")"
  200. IF ((!(LEFT(nozsearch,1)="(" & RIGHT(nozsearch,1)=")") & (((INSTR(nozsearch,"&")<>0) | (INSTR(nozsearch,"|")<>0))))) nozsearch = "("+nozsearch+")"
  201. IF (flag_match = "Yes") temp2 = " D"
  202. IF (flag_match = "No") temp2 = ""
  203. IF (file_date=000000) temp = ""
  204. IF (file_date<>000000) GOSUB CRUNCH_DATE
  205. IF (file_date<>000000) temp = "N "+temp+" "
  206. IF (nozsearch <> "") z_command="Z "+zsearch+" & ! "+nozsearch+" "+temp+directories+temp2
  207. IF (nozsearch = "")  z_command="Z "+zsearch+" "+temp+directories+temp2
  208. IF (zsearch = "")    z_command="Z ! "+nozsearch+" "+temp+directories+temp2
  209. IF (nozsearch = "" & zsearch = "") z_command="No search created yet"
  210. RETURN
  211.  
  212.  
  213. ; --------------------------------------------------------------------------
  214. ;  Build both the display and the actual search string for the (L) command.
  215. ; --------------------------------------------------------------------------
  216.  
  217. :Build_L
  218. IF (file_date <> 000000) THEN
  219.    GOSUB CRUNCH_DATE
  220.    l_command="L "+filename+" N "+temp+" "+directories
  221. ENDIF
  222. IF (file_date = 000000) l_command="L "+filename+" "+directories
  223. IF (flag_match = "Yes") l_command=l_command+" D"
  224. IF (filename="") l_command="No search created yet"
  225. RETURN
  226.  
  227.  
  228. ; --------------------------------------------------------------------------
  229. ;  Prompt the user for the text they want to exclude in (Z) search.
  230. ; --------------------------------------------------------------------------
  231.   
  232. :Z_EXCLUDE
  233. IF (!U_EXPERT) DISPFILE PPEPATH()+"ZXCLUDE.SRC",1
  234. PRINTLN
  235. INPUTSTR "Enter text to exclude",nozsearch,0Ah,54,file_chars+"|",30
  236. RETURN
  237.  
  238.  
  239. ; --------------------------------------------------------------------------
  240. ;  Prompt user for the text that they want to include in the (Z) search.
  241. ; --------------------------------------------------------------------------
  242.  
  243. :Z_MATCH
  244. IF (!U_EXPERT) DISPFILE PPEPATH()+"ZMATCH.SRC",1
  245. PRINTLN
  246. INPUTSTR "Enter Text to Search For",zsearch,0Ah,54,file_chars+"|",30
  247. RETURN
  248.  
  249.  
  250. ; --------------------------------------------------------------------------
  251. ;  Strip the date of "-" characters so that PCBoard will recognize the date. 
  252. ; --------------------------------------------------------------------------
  253.  
  254. :Crunch_Date
  255. temp = LEFT(file_date,2)+MID(file_date,4,2)+RIGHT(file_date,2)
  256. RETURN
  257.  
  258.  
  259. ; -----------------------------------------------------------------------
  260. ; Display currently selected search parameters for the (Z)ippy command.
  261. ; -----------------------------------------------------------------------
  262.  
  263. :zsearch_Params
  264. CLS
  265. GOSUB Build_Z
  266. PRINTLN "@X10┌──────────────────────────────────────────────@X19┐@X07"
  267. PRINTLN "@X10│ @X1FFile Text Search Criteria                    @X19│@X07"
  268. PRINTLN "@X10└@X19──────────────────────────────────────────────┘@X07"
  269. PRINTLN
  270. PRINTLN
  271. PRINTLN "@X0AMatching: @X0F", zsearch
  272. PRINTLN "@X0A Exclude: @X0F", nozsearch
  273. PRINTLN
  274. IF (file_date = 000000) PRINTLN "@X0AAny file date greater than or equal to: @X07N/A"
  275. IF (!file_date= 000000) PRINTLN "@X0AAny file date greater than or equal to: @X0F", file_date
  276. PRINTLN "@X0AIn the following directories (A = ALL): @X0F", directories
  277. PRINTLN "      @X0AFlag matching files for download: @X0F", flag_match
  278. PRINTLN
  279. PRINTLN "@X0E  Although the search will automatically be performed when you select"
  280. PRINTLN "  the S option below, you can type following at a conference command"
  281. PRINTLN "  prompt to perform the same search:"
  282. PRINTLN 
  283. PRINTLN "     @X0F"+z_command
  284. NEWLINES 2
  285. RETURN
  286.  
  287.  
  288. ; -----------------------------------------------------------------------
  289. ; Display currently selected search parameters for the (L)ocate command.
  290. ; -----------------------------------------------------------------------
  291.  
  292. :LSearch_Params
  293. CLS
  294. GOSUB Build_L
  295. PRINTLN "@X20┌──────────────────────────────────────────────@X2A┐@X07"
  296. PRINTLN "@X20│ @X2FFilename Search Criteria                     @X2A│@X07"
  297. PRINTLN "@X20└@X2A──────────────────────────────────────────────┘@X07"
  298. PRINTLN
  299. PRINTLN "@X0E       Filename(s) to search for: @X0F",filename
  300. PRINTLN "@X0E   Directories to scan (A = All): @X0F",directories
  301. IF (file_date = 00000) PRINTLN "@X0E       Scan all files newer than: @X07N/A"
  302. IF (!file_date= 00000) PRINTLN "@X0E       Scan all files newer than: @X0F",file_date
  303. PRINTLN "@X0EFlag matching files for download: @X0F",flag_match
  304. PRINTLN
  305. PRINTLN "@X03  Although the search will automatically be performed when you select"
  306. PRINTLN "  the S option below, you can type following at a conference command"
  307. PRINTLN "  prompt to perform the same search:"
  308. PRINTLN 
  309. PRINTLN "     @X0F"+l_command
  310. NEWLINES 2
  311. RETURN
  312.