Hello All

  I've written this script to kill adverts and tidy the resultant message, I
was also supprised how much disc space it saved.

 Some of the lines are very long, so be aware of wrap. And you will need to
add any local adverts to the list, in order to tailor it to your needs.

All the best
   Jules

-- 8< -- Cut here -- 8< --
/*
 $VER: 1.00 CleanMessage.rexx (21-03-2001)
 $AUTHOR: by Jules ([EMAIL PROTECTED]) ©2001
 $DESCRIPTION:Kill the noise

This script was written to remove un-wanted material (adverts)
from messages. This is an early version so it carries on guarantee.

To use this script you will need:
 rexxreqtools.library (v37.95)
 Snoopdos (aminet/util/moni/SnoopDos.lha) (in libs: )
 Change v2.39 (aminet/text/misc/Change.lha) by Dirk Stoecker (put it in c: )
 FreshBar 1.1 (On Aminet/util/rexx/FreshBar.lha) (put it in c:)

 If SnoopDos is not in your system path you will need to change the
 'SNOOP' path to the full path of your copy.

To run this script:
 Open MD-2s' message list window, then select but do not open the message
 from which you wish to start the cleaning process.
 Then; in a shell window, type:
  rx path_to_script/CleanMessage.rexx N/A
  example: rx REXX:CleanMessage.rexx 100
  (if you do not wish to see any output then use: rx >NIL: REXX:CleanMessage.rexx 100)
 then press return.
 or you can add it to a button.
*/
OPTIONS RESULTS
PARSE ARG TARGETMESS

/* Snoopdos Path */
SNOOP='SNOOPDOS'

IF TARGETMESS <1 THEN DO
URQT=1
CALL ADDLIB("rexxreqtools.library", 0, -30, 0)
NL = '0a'x
CALL RTGETLONG('1','How Many Messages'NL'do you wish to clean',
,'Kill the noise by Jules',"_Clean|_Leave",'RTGL_MIN=1 RTGL_MAX=250')
IF RTRESULT~=1 THEN EXIT
TARGETMESS=RESULT
END

/* Default Path */
SNOOPPATH='RUN >NIL: "'||SNOOP||'" HIDEMETHOD=TOOLSMENU HIDE'

/* Is Microdot running */
IF ~SHOW('P','MD.1') THEN EXIT

/* The counter */
TARGETMESS=STRIP(TARGETMESS)

CALL PRAGMA 'D',FILEPATH
IF EXISTS('T:SnoopMD') THEN CALL DELETE('T:SnoopMD')

/* Is SnoopDos running; if not, start it */
IF ~SHOW('P','SNOOPDOS') THEN DO
 ADDRESS COMMAND SNOOPPATH
 ADDRESS COMMAND 'WAITFORPORT SNOOPDOS'
END

/* Set up Snoopdos */
ADDRESS SNOOPDOS
FUNCTIONS NONE;NOONLYSHOWFAILS;NOSHOWCLI;NOMONITORPACKETS
NOPACKETDEBUGGER;NOMONITORROMCALLS;IGNORESHELL;NOUSEDEVICENAMES
NOSHOWFULLPATH;OPEN;SHOWFULLPATH;CLEARBUFFER;FORMAT "%255n";ENABLE

/* Make the list of Files */
ADDRESS MD.1
DO I=1 TO TARGETMESS
 IF I<2 THEN READSELECTEDMSGS
 ELSE GOTOMSG NEXT
END ; DROP I

ADDRESS COMMAND 'WAIT'
ADDRESS SNOOPDOS;DISABLE;SAVEBUFFER "T:SnoopMD";QUIT
ADDRESS COMMAND 'WAIT'

IF ~EXISTS('T:SnoopMD') THEN EXIT

/* Find the correct line. */
PDRAW="";TARGETMESS=0
CALL OPEN('MD','T:SnoopMD','R')
CALL OPEN('DT','T:DETACH','W')
DO UNTIL EOF('MD')
 PDRAW=STRIP(READLN('MD'),'B')
 IF POS('DBX_',PDRAW)>1 THEN DO
  IF EXISTS(PDRAW) THEN DO
   CALL WRITELN('DT',PDRAW)
   TARGETMESS=TARGETMESS+1
  END
 END
END
CALL CLOSE('MD') ; CALL CLOSE ('DT')
CALL DELETE('T:SnoopMD')

ADDRESS COMMAND "RUN >NIL: C:FreshBar"
ADDRESS COMMAND 'WAITFORPORT FRESHBAR_REXX.1'
ADDRESS FRESHBAR_REXX.1
CREATEBARWINDOW '"Kill the noise"' ; WINDI1 = RESULT
ADDBAR WINDI1 TARGETMESS NAME 'Post:' ; BARDI1 = RESULT
SETBARWINDOWWIDTH WINDI1 200
SETPROGRESSMODE WINDI1 BARDI1 2
OPENBARWINDOW WINDI1

COUNTDOWN=TARGETMESS-1
CALL OPEN('DT','T:DETACH','R')
 DO UNTIL EOF('DT')
  SETCURRENT WINDI1 BARDI1 TARGETMESS-COUNTDOWN
  PDRAW=STRIP(READLN('DT'),'B')
  IF PDRAW>" " THEN CALL LETSGETTOIT
  COUNTDOWN=COUNTDOWN-1
 END
CALL CLOSE('DT')
QUIT

CALL DELETE('T:DETACH')
IF URQT=1 THEN CALL rtezrequest("Completed","Thank you","Kill the noise!")
 ELSE SAY 'Complete.'
EXIT

LETSGETTOIT:

EDITO.1='"------------------------ Yahoo! Groups Sponsor 
---------------------~-~>\0ADo you have 128-bit SSL encryption server security??\0AGet 
VeriSign\27s FREE Guide, \22Securing Your\0AWeb Site for Business.\22 Get it 
now!\0Ahttp://us.click.yahoo.com/\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?/TM\0A---------------------------------------------------------------------_->"'
EDITO.2='"------------------------ Yahoo! Groups Sponsor 
---------------------~-~>\0AGet great low international calling rates\0Afrom 
Neet2Phone! Click 
Here!\0Ahttp://us.click.yahoo.com/\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?/TM\0A---------------------------------------------------------------------_->"'
EDITO.3='"------------------------ Yahoo! Groups Sponsor 
---------------------~-~>\0AMake good on the promise you made at graduation to  
keep\0Ain touch. Classmates.com has over 14 million registered\0Ahigh school 
alumni--chances are you\27ll find your 
friends!\0Ahttp://us.click.yahoo.com/\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?/TM\0A---------------------------------------------------------------------_->"'
EDITO.4='"------------------------ Yahoo! Groups Sponsor 
---------------------~-~>\0ASecure your servers with 128-bit SSL encryption!\0AAGrab 
your copy of VeriSign\27s FREE Guide,\0A\22Securing Your Web site for Business.\22 Get 
it 
now!\0Ahttp://us.click.yahoo.com/'"\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?"'/TM\0A---------------------------------------------------------------------_->"'
EDITO.5='"------------------------ Yahoo! Groups Sponsor 
---------------------~-~>\0AWe give away $70,000 a month! Come to iWin.com for\\0Ayour 
chance to 
win!\0Ahttp://us.click.yahoo.com/\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?/TM\0A---------------------------------------------------------------------_->"'
EDITO.6='"________________________________________________\0ADo You Yahoo!?\0AGet 
email at your own domain with Yahoo! Mail. \0Ahttp://personal.mail.yahoo.com/"'
EDITO.7='"_________________________________________________________\0ADo You 
Yahoo!?\0AGet your free @yahoo.com address at http://mail.yahoo.com"'
EDITO.8='"_____________________________________________________\0ADo You Yahoo!?\0AGet 
your free @yahoo.\?\? address at http://mail.yahoo.\?\?"'
EDITO.9='"Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/"'

DO I= 1 TO 9
 ADDRESS COMMAND 'C:CHANGE FROM '||PDRAW||' '||EDITO.I
END

DO I= 1 TO 4
 ADDRESS COMMAND 'C:CHANGE FROM '||PDRAW||' '||'"\0A\0A\0A"'||' TO '||PDRAW||' 
'||'"\0A\0A"'
END

ADDRESS COMMAND 'C:CHANGE FROM '||PDRAW||' '||'"> >"'||' TO '||PDRAW||' '||'">>"'
ADDRESS COMMAND 'C:CHANGE FROM '||PDRAW||' '||'"Re: Re:"'||' TO '||PDRAW||' '||'"Re:"'
ADDRESS COMMAND 'C:CHANGE FROM '||PDRAW||' '||'"<sb>"'||' TO '||PDRAW||' '||'" "'
ADDRESS COMMAND 'C:CHANGE FROM '||PDRAW||' '||'"<tsb>"'||' TO '||PDRAW||' '||'" "'

RETURN

/*
 CR = \0A
 '  = \27
 "  = \22
 Match = \?
*/

-- 8< -- And here -- 8< --
__________________________________________________________________
MicroDot-II Mailing List - http://www.vapor.com/md2/
MicroDot-II FAQ: http://faq.vapor.com/md2/
Listserver Help: mailto:[EMAIL PROTECTED]?Subject=HELP
Unsubscribe....: mailto:[EMAIL PROTECTED]?Subject=UNSUBSCRIBE

Reply via email to