/* Aminetfind script plug-in for AWeb
$VER: AWebAminet.rexx 1.0ß2 (28.3.96) by Sami Itkonen
What does it do:
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Find Files from Aminet, using the TCP: device that comes with AmiTCP.
What does it not do:
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Parse Aminet RECENT files, thus it doesn't operate as an ADT client.
Installation:
ŻŻŻŻŻŻŻŻŻŻŻŻŻ
Place the script in the same directory as the AWeb executable.
Activate "Allow Shell commands in Links" in the 'Network1:General'
settings of AWeb.
Usage:
ŻŻŻŻŻŻ
Click the 'Start ARexx Macro' (Amiga-!) in the AWeb menu, and select
this script
OR execute 'run >NIL: rx AWebAminet.rexx' in the AmigaDOS shell.
Any problems?
ŻŻŻŻŻŻŻŻŻŻŻŻŻ
The most common problems are dealt with by the script (like the
inaccessibility of TCP:). If the 'Submit' button in the form
doesn't work, then either
1) you don't have 'Allow Shell commands in Links' checked
2) the script is not in the same directory as AWeb
3) accessing the findserver is simply slow. In that case you
consider using a different findserver.
Note about FTP:
Whatever (ftp://) URLs are in the Aminetfind Results are
perfectly valid HTML. If they don't work, then either
1) the FTP site in question is inaccessible for the moment
2) you don't have FTP configured properly. See
Network3:External programs in AWeb settings.
For a suitable FTP script, you can use eg.
Josef Faulkner's AwebFTP (available in Aminet)
Any other problems, weird or not, outright bugs, HTML errors and
such can be reported to the Author (mail to Sami.Itkonen@hut.fi).
*/
/* Configuration of the script: */
def_site = 'ftp.germany.aminet.org' /* Your default Aminet site */
def_findsite = 'haegar2.uni-paderborn.de' /* Your default findserver */
/* Main Script */
options results
call Initialize
parse arg args
call ParseCmds
action = upper(action)
select
when action = "FIND" then call FindWord
when action = "CREATE" then call CreateForm
when action = "ABOUT" then call About
otherwise
call CreateForm
end
exit
FindWord:
if keyword ~= "" then do
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(2,'tcp:'||findsite||'/1848',w) then do
address command 'delete t:awebfind#?.html >NIL:'
fname='t:awebfind'time(S)'.html'
call open(1,fname,w)
call writeln(1,'
AminetFind results')
call writeln(1,'AminetFind Results
')
call writeln(2,'max 'maxhits)
call writeln(2,'width 'width)
if exact="ON" then do
if case="ON" then call writeln(2,'Find "'keyword'"')
else
call writeln(2,'find "'keyword'"')
end
else do
if case="ON" then call writeln(2,'Find 'keyword)
else
call writeln(2,'find 'keyword)
end
call writeln(2,'quit')
do until eof(2)
text=readln(2)
select
when left(text,6)='*** No' then call writeln( 1, 'No matches found.
')
when left(text,6)='*** Ad' then do
call writeln( 1, '')
call writeln( 1, 'Additional Matches Found.
')
call writeln( 1, '')
end
when text = '' then foo = 1
when text = 'Unknown command (? for help).' then foo = 1
otherwise
call WriteLine
end
end
if found then call writeln(1,'')
call writeln(1,'
')
call writeln(1,'
Created by 'version'')
call close(1)
address AWEB.1 'OPEN file://localhost/'fname
end
else FindError('Error opening TCP:')
end
else FindError('You need AmiTCP installed in the proper directories, or mount TCP:')
end
return
Writeline:
parse var text file.name file.dir file.size file.age file.desc
astpos = pos('*', file.age)
if findsite = 'haegar2.uni-paderborn.de' then do
file.desc = file.age||file.desc
file.age = ''
end
else if astpos ~= 0 then do
file.desc = substr(file.age, astpos + 1) || file.desc
file.age = left(file.age, astpos - 1)
end
file.desc = strip(file.desc)
dot = lastpos(".", file.name)
if ~found then do
found = 1
call writeln( 1, "FILE DIR SIZE AGE DESCRIPTION" )
end
if (dot > 0) then
file.readme = left(file.name, dot) || 'readme'
else
file.readme = file.name'.readme'
file.desc = translate(file.desc,'''','"')
if file.name ~= "" then do
lin = '- 'file.name''
lin = lin copies(' ', 19 - length(file.name)) file.dir
lin = lin copies(' ', 10 - length(file.dir))
lin = lin copies(' ', 4 - length(file.size)) file.size
lin = lin copies(' ', 3 - length(file.age)) file.age
lin = lin ' 'file.desc''
call writeln( 1, lin)
end
return
FindError:
parse arg text
address command 'delete t:awebfind#?.html >NIL:'
fname='t:awebfind'time(S)'.html'
call open(1,fname,w)
call writeln(1,'AminetFind Error')
call writeln(1,'
AminetFind Error
')
call writeln(1,''text'')
call writeln(1,'
Created by 'version'')
call close(1)
address AWEB.1 'OPEN file://localhost/'fname
return
Initialize:
if ~show(l, 'rexxsupport.library') then
if ~addlib('rexxsupport.library', 0, -30, 0) then exit 50
/* if ~show(l, 'rexxdossupport.library') then
if ~addlib('rexxdossupport.library', 0, -30, 0) then exit 50*/
keyword = ""
exact = "OFF"
case = "OFF"
maxhits=40
width=100
found=0
if def_site ~= "" then aminetsite = def_site
else
aminetsite = "ftp.wustl.edu"
if def_findsite ~= "" then findsite = def_findsite
else
findsite = "ftp.wustl.edu"
version = 'AWebAminet.rexx 1.0ß2 by Sami Itkonen'
sversion = 'AWebAminet.rexx 1.0ß2 by Sami Itkonen'
return
ParseCmds:
parse var args "action=" '"' action '" ' rest
if left(rest,8) = "keyword=" then parse var rest "keyword=" '"' keyword '" ' rest
if left(rest,6) = "exact=" then parse var rest "exact=" '"' exact '" ' rest
if left(rest,5) = "case=" then parse var rest "case=" '"' case '" ' rest
if left(rest,11) = "aminetsite=" then parse var rest "aminetsite=" '"' aminetsite '" ' rest
if left(rest,9) = "findsite=" then parse var rest "findsite=" '"' findsite '"' rest
return
CreateForm:
address command 'delete t:awebfind#?.html >NIL:'
form='t:awebfind'time(S)'.html'
call open(5,form,w)
call writeln(5,'AminetFind FormAminetFind Form for AWeb
')
call writeln(5,'')
call writeln(5,'
Created by 'version'')
call close(5)
address AWEB.1 'OPEN file://localhost/'form
return
About:
address command 'delete t:awebfind#?.html >NIL:'
about='t:awebfind'time(S)'.html'
call open(5,about,w)
call writeln(5,'About AWebAminet')
call writeln(5,'AWebAminet.rexx - AminetFind script for AWeb
')
call writeln(5,'Contacting the Author:
')
call writeln(5,'- Email
- Sami.Itkonen@hut.fi')
call writeln(5,'
- WWW
- http://www.hut.fi/~samzait/
')
call writeln(5,'Where to find new AWeb stuff ?
')
call writeln(5,'
Created by 'sversion'')
call close(5)
address AWEB.1 'OPEN file://localhost/'about
return