home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 13
/
AACD13.ISO
/
CDTools
/
S
/
QuickSearch.awebrx
< prev
next >
Wrap
Text File
|
2000-08-18
|
3KB
|
75 lines
/*
$VER: QuickSearch.awebrx 1.2 (28.3.00) (c) Neil Bothwick, Wirenet
QuickSearch - Searches the index of the current CD
*/
/* ;;; Initialise */
options results
CDname = 'AACD13:'
IndexFile = CDName'CDTools/indices/'compress(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