home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / CDTools / S / QuickSearch.awebrx < prev    next >
Text File  |  1999-10-07  |  2KB  |  62 lines

  1. /*
  2. QuickSearch - Searches the index of the current CD
  3. $VER: QuickSearch.awebrx 1.0 (2.9.99) (c) Neil Bothwick, Wirenet
  4. */
  5.  
  6. /* ;;; Initialise */
  7. options results
  8. CDname = 'AACD03:'
  9. IndexFile = CDName'CDTools/indices/'compress(CDName,':')
  10. TempFile = 'T:QuickSearch.temp'
  11. ResultFile = 'T:QuickSearch.html'
  12. AWebPort = address()
  13. ;;;     
  14. /* ;;; Search index file */
  15. parse arg SearchStr
  16. SearchStr = translate(SearchStr,' ','+')
  17. address command CDName'System/C/FlashFind >'TempFile IndexFile '"'SearchStr'" NOPREFS QUIET NH'
  18. if RC > 0 then call ExitMsg('No matches found for *"'SearchStr'*"')
  19. ;;;     
  20. /* ;;; Open output file and write headers */
  21. call open(in,TempFile,'R')
  22. call open(out,ResultFile,'W')
  23. call writeln(out,'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">')
  24. call writeln(out,'<html><head><title>Search results</title></head><body bgcolor=white>')
  25. call writeln(out,'<h3 align=center>Result of searching for "<font color=red>'SearchStr'</font>"</h3>')
  26. call writeln(out,'<table width="100%">')
  27. ;;;  
  28. /* ;;; Process result into HTML */
  29. do until eof(in)
  30.     line = readln(in)
  31.     if line = '' then iterate
  32.     parse var line name =34 path
  33.     name = strip(name)
  34.     line = '<tr><td>'name'<td><a href="x-aweb:rexx/'left(path,pos(':',path))'CDTools/S/ShowDir 'PathPart(path)'">'path'</a>'
  35.     call writeln(out,line)
  36.     end
  37. call writeln(out,'</table></body></html>')
  38. ;;;  
  39. /* ;;; Close files and load into AWeb */
  40. call close(in)
  41. call close(out)
  42. address command 'delete >NIL:' TempFile
  43. 'open file://localhost/'ResultFile' target main reload'
  44. 'wait file://localhost/'ResultFile
  45. address command 'delete >NIL:' ResultFile
  46. ;;;
  47. exit
  48.  
  49. /* ;;; Exit with a message */
  50. ExitMsg:
  51.     parse arg msg
  52.     'request title "AACD QuickSearch" body "'msg'" gadgets "OK"'
  53.     exit
  54.     return
  55. ;;;
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.