/*) FASTAminetFind v2.2 by Josef Faulkner (panther@gate.net) IRC: Josef \\\ Written for Grapevine 2.0 beta "Converted" by Ariel Magnum to AmIRC Arexx 1. Fixed/extended cmd parsing and handling so you can now use the AmIRC RAW output commands as : /find mui36usr raw notice Ariel will send the results to me via notice but will not be displayed on your amirc lister(hence RAW). 2. Added AmIRC prefix to echos 3. Added variable of the aminet search site Change it here and note that not all aminet sites support Aminet find. */ aminetsite='ftp.wustl.edu' /* /// \\\ Usage: /// /alias find rx aminetfind.gvrexx \\\ /find [EXACT] <"substring"|"sub strings"> [output] [-w] [-m] /// \\\ Output is the command that will be launched with the results as the argument /// \\\ Examples: /// /find shapeshift echo \\\ «Echo» | ssfaq09.lha docs/help 48K 3 ShapeShifter FAQ 0.9 (preliminary) /// «Echo» | MacRomTest.lha misc/emu 1K 9 Shows version & verifies ShapeShifte \\\ ... /// Other examples: \\\ /find shapeshift msg josef - sends output in a message to josef /// /find shapeshift say - sends output to the channel \\\ /find shapeshift me - if your nick is Aminet, this might be good :) /// /find "irc client" - Searches for anything with "irc" AND "client" \\\ /find "irc client" say - and sends it to the channel /// /find exact "irc client" - Searches for anything with "irc client" exactly \\\ /find exact "irc client" say - and sends it to the channel /// /find grapevine say -m1 - Shows only one line of output \\\ /find grapevine say -m5 - Shows 5 lines of output /// /find grapevine say -w120 - Truncates output to 120 characters \\\ /find grapevine say -w60 -m10 - Shows up to 10 lines truncating to 60 width /// /find "comm/net irc grape" - Will search for comm/net (the directory) \\\ /find exact " /// \\\ Set maxsend to the maximum number of lines to send (does not affect echo) /// \\\ New Stuff: /// 1.1: \\\ o Now searches for multiple keywords... /// 1.2: \\\ o Now searches for two or more words exactly. Use " quotes around the /// search string to do this. \\\ 2.0: /// o Now you can set the maximum number of items (-m) \\\ o Now you can set the maximum length of hte line (-w) /// 2.1: \\\ o bugfixes /// 2.2: \\\ o Now reports errors more exactly (none found, maximum matches) /// Notes: \\\ o If you search for more than one keyword you MUST put it in quotes. /// o Quotes must be " quotes, not ' quotes. \\\ o - options MUST be the last options on the line. (*/ if ~show('L','rexxsupport.library') then if ~addlib('rexxsupport.library',0,-30,0) then do 'echo P=«Aminet» You need rexxsupport.library version 30 or greater in libs:' exit 10 end maxchansend=5 maxechosend=20 width=70 bold=d2c(2) parse arg cmds do while left(word(cmds,words(cmds)),1)='-' lw=upper(word(cmds,words(cmds))) lc=left(lw,2) num=right(lw,length(lw)-2) if lc='-M' then do maxchansend=num maxechosend=num end if lc='-W' then do width=num end cmds=reverse(cmds) parse var cmds .' 'cmds cmds=reverse(cmds) end if upper(word(cmds,1))='EXACT' then do exact=1 parse var cmds .' 'cmds end else exact=0 if index(cmds,'"')>0 then do parse var cmds '"'name'"' cmd end else do parse var cmds name' 'cmd end if exact then name='"'name'"' 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 cmd='' then cmd='echo' name=strip(name) otext='Finding: ' if exact then otext=otext||'(exact) ' otext=otext||bold||name||bold cmd=strip(cmd) if cmd~='' then otext=otext||', output command 'bold||cmd||bold otext=otext||', width 'bold||width||bold if upper(cmd)~='ECHO' then do length=maxchansend otext=otext||', maxlength 'bold||maxchansend||bold end else do length=maxechosend otext=otext||', maxlength 'bold||maxechosend||bold end otext=otext||'.' if address()='REXX' then say 'Finding 'name else 'echo P=«Aminet» 'otext outcmd=cmd Select when upper(outcmd)='ECHO' then outcmd='ECHO P=«Aminet»' when pos('RAW',upper(outcmd))=1 then do parse var outcmd . tcmd tnick outcmd='RAW' tcmd tnick ':' end when upper(outcmd)~='SAY' then outcmd='SAY /'outcmd otherwise end call open(2,'t:a',w) if open(1,'tcp:'aminetsite'/1848',w) then do call writeln(1,'max 'length) call writeln(1,'width 'width) call writeln(1,'find 'name) call writeln(1,'max') cnt=0 do until eof(1) text=readln(1) call writeln(2,text) if text='Missing argument.' then leave else do if address()='REXX' then say text else do select when left(text,6)='*** No' then outcmd 'No Matches Found.' when left(text,6)='*** Ad' then outcmd 'Additional Matches Found (use higher -m value for more).' otherwise outcmd' 'text end end end cnt=cnt+1 if (cnt>=maxsend)&(upper(cmd)~='ECHO') then leave end call writeln(1,'quit') end else 'echo P=«Aminet» Error opening TCP:' end else 'echo P=«Aminet» You need AmiTCP installed in the proper directories, or mount TCP:'