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/WebSites/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
;;;
/* ;;; 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
if ~exists('C:FlashFind') then 'copy 'CDname':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'),'')
if exists('ENV:AminetIndex') then AminetPath = AddPart(GetVar('AminetIndex'),'')
else AminetPath = CDname':AACD/Online/Aminet/'
OutFile = 'T:SearchCDs.results'
;;;
/* ;;; Define MUI variables */
MUIA_List_Quiet = 0x8042d8c7
MUIM_List_Select = 0x804252d8
MUIV_List_Select_All = -2
MUIV_List_Select_On = 1
MUIV_List_Select_Ask = 3
MUIA_List_First = 0x804238d4
MUIM_List_Remove = 0x8042647e
MUIV_List_Remove_Selected = -3
MUIA_List_Entries = 0x80421654
MUIA_List_Quiet = 0x8042d8c7
MUIA_Listview_MultiSelect = 0x80427e08
MUIV_Listview_MultiSelect_Default = 1
MUIA_Gauge_Current = 0x8042f0dd
MUIA_Gauge_Divide = 0x8042d8df
MUIA_Gauge_Horiz = 0x804232dd
MUIA_Gauge_InfoText = 0x8042bf15
MUIA_Gauge_Max = 0x8042bcdb
MUIA_Group_Columns = 0x8042f416
MUIA_Menuitem_Shortcut = 0x80422030
MUIA_Application_Active = 0x804260ab
MUIA_Application_Author = 0x80424842
MUIA_Application_Copyright = 0x8042ef4d
MUIA_Application_Description = 0x80421fc6
MUIA_Application_HelpFile = 0x804293f4
MUIA_Application_Iconified = 0x8042a07f
MUIA_Application_Title = 0x804281b8
MUIA_Application_Version = 0x8042b33f
MUIA_Application_Sleep = 0x80425711
MUIM_Application_AboutMUI = 0x8042d21d
TRUE = 1
FALSE = 0
;;;
/* ;;; Load libraries */
call LoadLib('rexxsupport.library')
call LoadLib('rexxdossupport.library')
call LoadLib('rexxreqtools.library')
;;;
/* ;;; Open arexx port and GUI */
thisport = openport(PrgPort)
if thisport = 0 then exit
address(GuiPort)
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')