SearchCDs - Searches index files of Amiga Active CDs,
Aminet CDs and Aminet Online files
$VER: SearchCDs 1.4 (14.12.99) (c) Neil Bothwick, Wirenet
*/
/* ;;; Initialise */
options results
signal on error
/* Make sure we have enough stack */
CurrStack = pragma('S',16384)
if CurrStack > 16384 then call pragma('S',CurrStack)
/* Set some variables */
VerStr = sourceline(4)
VerStr = subword(VerStr,2,words(VerStr) - 4)
Title = 'SearchCDs'
GuiPort = upper(Title)
PrgPort = GuiPort'-PRG'
WinTitle = 'Amiga Active CD Search'
WinTitle = 'Amiga Active CD preferences'
qt = '22'x
lf = '0a'x
GF = '<font color="green"><b>GF</b></font>'
GF = '<font color="red"><b>Q</b></font>'
/* Are we running from CD or HD? */
CurrentDir = pragma('D')
parse var CurrentDir CDname ':' .
if left(CDName,4) ~= 'AACD' then CDname = 'AACD'
signal off error
address command 'Assign >NIL: 'CDName': EXISTS'
CDMounted = ~(RC % 5)
/* Is registered AWeb available? */
address command 'Assign >NIL: AWeb3: EXISTS'
Browser = ''
if RC = 0 then do
address command 'Version >NIL: AWeb3:AWeb-II 3 3'
if RC = 0 then Browser = 'AWeb3:AWeb-II'
end
else if CDMounted = 1 then Browser = CDName':AACD/Information/Browsers/AWeb3/AWebDemo'
signal on error
AminetServer = 'de.aminet.net'
select
when right(CurrentDir,6) = 'Aminet' then DefSearch = 'Aminet Online'
when right(CurrentDir,3) = 'CDs' then DefSearch = 'Aminet CDs'
when right(CurrentDir,4) = 'Sets' then DefSearch = 'Aminet Sets'
otherwise DefSearch = 'Amiga Active CDs'
end
/* Load libraries */
call LoadLib('rexxsupport.library')
call LoadLib('rexxdossupport.library')
call LoadLib('rexxreqtools.library')
;;;
/* ;;; Check for MUI */
address command 'Assign >NIL: MUI: EXISTS'
if RC > 0 then do
address command 'RequestChoice >NIL: "Amiga Active CD" "This program require Magic User Interface*NRun the Welcome script for a temporary MUI setup,*Nor install it from the CDTools drawer of the CD" "OK"'
exit
end
;;;
/* ;;; Set index variables and ensure all necessary files are available */
address command
signal off error
'which >NIL: FlashFind'
signal on error
if RC = 5 then 'copy 'CDname':System/C/FlashFind C: clone quiet'
if exists('ENV:AACDIndex') then AACDPath = AddPart(GetVar('AACDIndex'),'')
else AACDPath = CDname':CDTools/indices/'
if exists('ENV:AminetCDIndex') then AminetCDPath = AddPart(GetVar('AminetCDIndex'),'')
window id MAIN port PrgPort command 'QUIT' title '"'WinTitle'"'
group id ALL
group horiz attrs MUIA_Group_Columns 2
group horiz attrs MUIA_Group_Columns 2
label double 'Search string'
string id SCSTR help '"Enter a string to search for"' /* content 'test' */
label double 'CDs to search'
cycle id CDTYP port PrgPort command 'RESCAN' help '"Which types of CD do\nyou wish to search?"' labels 'Amiga Active CDs,Aminet CDs,Aminet Sets,Aminet Online'
label double 'Output format'
if Browser > '' then cycle id OPFMT help '"Choose the output format"' labels 'HTML,Text,Amigaguide'
else cycle id OPFMT help '"Choose the output format"' labels 'Text,Amigaguide'
endgroup
if exists('AALogo.ilbm') then image id LOGO pict AALogo.ilbm
call writeln(out,'<h3 align=center>Result of searching 'Source' for "<font color=red>'SearchStr'</font>"</h3>')
call writeln(out,'<table width="100%">')
/* Process output into HTML */
'gauge id PROGR attrs' MUIA_Gauge_Max word(statef(OutFile),2) MUIA_Gauge_InfoText '"Processing search results"'
BytesDone = 0
select
when Source = 'Amiga Active CDs' then do
/* Format output */
do until eof(res)
line = readln(res)
BytesDone = BytesDone + length(line) + 1
if line = '' then iterate
parse var line name =34 path
name = strip(name)
line = '<tr><td>'name'<td><a href="x-aweb:rexx/REXX:AAShowDir 'PathPart(path)'">'path'</a>'
call writeln(out,line)
'gauge id PROGR attrs' MUIA_Gauge_Current BytesDone
end
end
when Source = 'Aminet CDs' then do
/* Format output */
call readln(res)
do until eof(res)
CDTitle = readln(res)
call SetCDTitle()
line = readln(res)
do while ~eof(res) & line ~= ''
BytesDone = BytesDone + length(line) + 1
if left(line,1) ~= '|' then do
/*parse var line name =19 path =30 size +5 age +5 desc*/
interpret parsecmd
name = strip(name)
path = CDTitle'Aminet/'strip(path)'/'name
readme = left(path,lastpos('.',path))'readme'
line = '<tr valign=top><td><a href="x-aweb:rexx/REXX:AAExtract 'path'">'name'<td align=right>'strip(size)'<td><a href="file://localhost/'readme'">'desc'</a>'
call writeln(out,line)
'gauge id PROGR attrs' MUIA_Gauge_Current BytesDone
end
line = readln(res)
end
end
end
when Source = 'Aminet Sets' then do
/* Format output */
call readln(res)
do until eof(res)
line = readln(res)
BytesDone = BytesDone + length(line) + 1
if left(line,1) = '|' then iterate
parse var line name =20 path +11 size +5 age +4 CD +2 x +1 desc
name = strip(name)
path = 'AminetSet'CD':Aminet/'strip(path)'/'name
readme = left(path,lastpos('.',path))'readme'
line = '<tr><td><a href="x-aweb:rexx/REXX:AAExtract 'path'">'name'<td align=right>'strip(size)'<td><a href="file://localhost/'readme'">'desc'</a>'
call writeln(out,line)
'gauge id PROGR attrs' MUIA_Gauge_Current BytesDone
end
end
when Source = 'Aminet Online' then do
/* Format output */
call writeln(out,'<tr><td colspan="4">Click on the file name to download it or the description to download the readme. This requires that you are online and does not work with the AACD Special Edition browser.<p>')
call writeln(out,'Alternatively, click on 'GF' to add the file or readme to the GoFetch! download queue.')
call writeln(out,'This requires that you have GoFetch! installed, you can install it from ')
'gauge id PROGR attrs' MUIA_Gauge_Current BytesDone
end
call writeln(out,'<tr><td align=center colspan=4><p><hr><p><h5>The age is given in weeks since the date of this index ('date('N',word(statef(AddPart(IndexPath,'INDEX')),5),'I')')</h5>')
end
otherwise call ShowMsg('Not done this bit yet')
end
call writeln(out,'</table></body></html>')
call close(res)
call close(out)
/* Load HTML */
signal off error
address command 'waitforport' AWebPort
signal on error
if RC > 0 then call ExitMsg('Unable to start AWeb')