home *** CD-ROM | disk | FTP | other *** search
- /*
- QuickSearch - Searches the index of the current CD
- $VER: QuickSearch.awebrx 1.3 (8.11.2000)
- (c) Neil Bothwick, Wirenet
-
- 1.3 - Uses "parse source" to get the name of the CD
- */
-
- /* ;;; Initialise */
- options results
- parse source . ' ' . ' ' . ' ' ScriptName ' ' .
- CDName = left(ScriptName, pos(':', ScriptName) - 1)
- IndexFile = CDName':CDTools/indices/'CDName
- TempFile = 'T:QuickSearch.temp'
- ResultFile = 'T:QuickSearch.html'
- if ~show('L','rexxsupport.library') then call addlib('rexxsupport.library',0,-30,0)
- if ~show('L','rexxdossupport.library') then call addlib('rexxdossupport.library',0,-30,0)
-
- AWebPort = address()
- if ~abbrev(AWebPort,'AWEB.') then do
- do i = 1 to 25
- if show('P','AWEB.'i) then do
- AWebPort = 'AWEB.'i
- leave
- end
- end
- if ~abbrev(AWebPort,'AWEB.') then exit
- address(AWebPort)
- end
- 'get url target=main'
- OldPage = result
- 'open file://localhost/'CDName':html/Searching.html target main reload'
- ;;;
- /* ;;; Search index file */
- parse arg SearchStr
- if abbrev(SearchStr,'SearchStr="') then parse var SearchStr . '="' SearchStr '"'
- SearchStr = translate(SearchStr,' ','+')
- address command CDName':System/C/FlashFind >'TempFile IndexFile '"'SearchStr'" NOPREFS QUIET NH'
- if RC > 0 then Found = 'NO'
- ;;;
- /* ;;; Open output file and write headers */
- call open(out,ResultFile,'W')
- call writeln(out,'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">')
- call writeln(out,'<html><head><title>Search results</title></head><body bgcolor=white>')
- call writeln(out,'<p><h4 align="center"><a href="'OldPage'">Return to previous page</a></h4><p>')
- call writeln(out,'<h3 align=center>Result of searching for "<font color=red>'SearchStr'</font>"</h3>')
- ;;;
- /* ;;; Process result into HTML */
- if Found = 'NO' then do
- call writeln(out,'<h3 align=center>No matches found for "<font color=red>'SearchStr'</font>" on this CD</h3>')
- call writeln(out,'<p><h4 align="center">Would you like to <a href="file://localhost/'CDName':html/SearchCDs.html">Search other CDs</a> or</h4><p>')
- end
- else do
- call open(in,TempFile,'R')
- call writeln(out,'<table width="100%">')
- do until eof(in)
- line = readln(in)
- if line = '' then iterate
- parse var line name =34 path
- name = strip(name)
- line = '<tr><td>'name'<td><a href="x-aweb:rexx/'left(path,pos(':',path))'CDTools/S/AAShowDir 'PathPart(path)'">'path'</a>'
- call writeln(out,line)
- end
- call writeln(out,'</table>')
- end
- call writeln(out,'<p><h4 align="center"><a href="'OldPage'">Return to previous page</a></h4><p>')
- call writeln(out,'</body></html>')
- ;;;
- /* ;;; Close files and load into AWeb */
- call close(in)
- call close(out)
- address command 'delete >NIL:' TempFile
- 'open file://localhost/'ResultFile' target main reload'
- 'wait file://localhost/'ResultFile
- address command 'delete >NIL:' ResultFile
- ;;;
- exit
-
-