home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 46
/
Amiga_Dream_46.iso
/
Amiga
/
Internet
/
Irc
/
ChatBox1_164.lha
/
Rexx
/
aminetfind3.cb
< prev
next >
Wrap
Text File
|
1997-10-24
|
3KB
|
94 lines
/* AminetFind Arexx script for ChatBox
Written by Josef Faulkner (panther@gate.net) IRC: Josef
This script will connect to an ADT search port on an Aminet findserver
and use the port to do a very fast search of the complete aminet index
for some keywords.
*/
if ~show('L','rexxsupport.library') then if ~addlib('rexxsupport.library',0,-30,0) then exit 20
indexfile='dh2:net/index'
parse arg chan' 'keywords
if keywords='' then do
CMD '/echo Usage: /find [-opts] keywords'
CMD '/echo Opts:'
CMD '/echo -SAY Says to current channel'
CMD '/echo -MAX <hits> Limits hits to <hits>'
CMD '/echo -TO <whom> Sends results to <whom>'
exit
end
length=10 /* Default number of max hits */
absmax=20 /* Absolute maximum hits to show */
width=80 /* Default maximum width of result text */
output='/echo'
do while left(keywords,1)='-'
CMD '/echo keyword found'
opt=word(keywords,1)
opt=upper(right(opt,length(opt)-1))
select
when opt='SAY' then do
output='/m' chan
CMD '/echo Saying results to channel.'
end
when opt='MAX' then do
if datatype(word(keywords,2),n) then do
length=word(keywords,2)
end
else do
CMD '/echo 'word(keywords,2)' needs to be a numerical option'
end
parse var keywords .' 'keywords
end
when opt='TO' then do
output='/m' word(keywords,2)
parse var keywords .' 'keywords
end
otherwise do
CMD '/echo Unrecognized Option: 'word(keywords,1)
end
end
parse var keywords .' 'keywords
end
if ~showlist(H,'TCP') then address command 'mount TCP: from amitcp:devs/inet-mountlist'
if ~showlist(H,'TCP') then address command 'mount TCP:'
if showlist(H,'TCP') then do
if open(1,'TCP:find.germany.aminet.org/1848',w) then do
call writeln(1,'find 'keywords)
call writeln(1,'quit')
linecnt=0
do until eof(1)
text=left(readln(1),width)
linecnt=linecnt+1
if linecnt<=length then do
if (text~='') then do
if left(text,3)='***' then linecnt=linecnt-1
if linecnt=1 then do
CMD output 'Searching for keywords: 'keywords', maxhits: 'length
CMD output 'File Dir Size Description'
end
if left(text,3)='***' then CMD '/echo' text
else CMD output text
if output~='/echo' then do
if linecnt//5=0 then call delay(250)
if linecnt>=absmax then do
CMD '/echo Absolute maximum hits reached (Flood Protection) Ending search.'
exit
end
end
end
else linecnt=linecnt-1
end
end
if linecnt=1 then CMD output linecnt' matche found.'
else CMD output linecnt' matches found.'
end
end