home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 46
/
Amiga_Dream_46.iso
/
Amiga
/
Internet
/
Irc
/
ChatBox1_164.lha
/
Rexx
/
find.cb
< prev
next >
Wrap
Text File
|
1997-10-24
|
3KB
|
99 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.
Usage is outlined via online help. While in CB, type /find by itself
to see the help information.
*/
if ~show('L','rexxsupport.library') then if ~addlib('rexxsupport.library',0,-30,0) then exit 20
indexfile='dh2:net/index'
parse arg keywords
length=10 /* Default number of max hits */
absmax=20 /* Absolute maximum hits to show */
width=80 /* Default maximum width of result text */
output='/echo'
if keywords='***NULL POINTER***' then do
LOCAL HDR '[Aminet]' TXT 'Usage: /find [-opts] keywords'
LOCAL HDR '[Aminet]' TXT 'Opts:'
LOCAL HDR '[Aminet]' TXT '-SAY Says to current channel'
LOCAL HDR '[Aminet]' TXT '-MAX <hits> Limits hits to <hits>'
LOCAL HDR '[Aminet]' TXT '-TO <whom> Sends results to <whom>'
exit
end
do while left(keywords,1)='-'
opt=word(keywords,1)
opt=upper(right(opt,length(opt)-1))
select
when opt='SAY' then do
output='/say'
LOCAL HDR '[Aminet]' '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
LOCAL HDR '[Aminet]' 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
LOCAL HDR '[Aminet]' '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 LOCAL HDR '[Aminet]' text
else CMD output text
if output~='/echo' then do
if linecnt//5=0 then call delay(250)
if linecnt>=absmax then do
LOCAL HDR '[Aminet]' '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' match found.'
else CMD output linecnt' matches found.'
end
else LOCAL HDR '[Aminet]' 'Could not open connection.'
end
else LOCAL HDR '[Aminet]' 'Could not mount TCP:'