Hello All

  These scripts do not so much 'forward' a message, but sends it on to a
new address.

  In order to use these scripts you need to have the programme 'Snoopdos',
if it's in you system path you can run them as they are; if it isn't you
will need alter the path in script one.

Script one.
--- 8< --- Cut --- AREXX --- Here --- 8< ---
/*
 $VER: 1.02 Attch_MD_Prt1.mdrx (16-02-2000)
 $AUTHOR: by Jules ([EMAIL PROTECTED]) �2000
 $DESCRIPTION: Parsing on attachments, part 1 of a two part script.

 Instructions
 1) Make sure you are not on line, and you can 'Queue' any message.
 2) In the 'message list window' select, but do not open, the message you
     intend to send on.
 3) Run part one, (Attch_MD_Prt1.mdrx).
 4) When the new message window opens, select the destination address.
     Do not worry that there is no body to the text, as this is added
     by the second script.
 5) 'Queue', but do not 'Send' the message.
 6) Close the current group, and open the 'Spool'.
 7) Select but do not open the new message in the 'Spool'.
 8) Run part two, Attch_MD_Prt2.mdrx, of this script, and wait for all disk
     activity to stop before you do anything else, please.
 9) To see if the scripts have worked you will need to close and then re-open
    the new message.
 */

/*
 Please enter the path of 'Snoopdos'
 Example SNOOP="SYS:Tools/Snoopdos"
 */

SNOOP="SNOOPDOS"

SETCLIP('SNP',SNOOP)

ADDRESS 'MD.1'
EXTRACTSELECTEDMSGS 'T:Messageheld NOREQ'

/*
 Find the correct line.
 */
DETEC=0 ; PDRAW="" ; DFILE=""
CALL OPEN('MH','T:Messageheld','R')
 DO UNTIL DETEC>0
  DFILE=READLN('MH')
   IF POS('Subject:',DFILE) THEN DO
    SBJCT='"'||STRIP(DFILE,,'Subject: ')||'"'
   END
  DETEC=POS('Content-Type',DFILE)
 END

/*
 Write the new file
 */
CALL OPEN('MHT','T:MessHeldTarget','W')
  CALL WRITELN('MHT',DFILE)
DO UNTIL EOF('MH')
  DFILE=READLN('MH') ; CALL WRITELN('MHT',DFILE)
END
CALL CLOSE('MH') ; CALL CLOSE('MHT')

/*
 Read the message in MD-II
 */
ADDRESS MD.1 ; NewMsgWindow SUBJECT SBJCT
EXIT
--- 8< --- Cut --- AREXX --- Here --- 8< ---


*And this is the second script*


--- 8< --- Cut --- AREXX --- Here --- 8< ---
/*
 $VER: 1.02 Attch_MD_Prt2.mdrx (16-02-2000)
 $AUTHOR: by Jules ([EMAIL PROTECTED]) �2000
 $DESCRIPTION: Parsing on attachments, part 2 of a two part script

 See part 1 for details.

 WARNING! Do not run this script without having run part one first.
 */

SNOOP=GETCLIP('SNP')

/*
 Check if SnoopDos is running; if not, then start it
 */
SNOOPPATH="RUN >NIL: "||SNOOP||" HIDEMETHOD=TOOLSMENU HIDE"
IF ~SHOW('P','SNOOPDOS') THEN DO
    ADDRESS COMMAND SNOOPPATH
    ADDRESS COMMAND "WAITFORPORT SNOOPDOS"
    END

/*
 Set up Snoopdos
 */
ADDRESS SNOOPDOS ; CLEARBUFFER ; FORMAT "%50n"

/*
 Read the message in MD-II
 */
ADDRESS MD.1 ; READSELECTEDMSGS ; ADDRESS COMMAND 'WAIT'

/*
 Save the SnoopDos Buffer
 */
ADDRESS SNOOPDOS ; SAVEBUFFER "T:SnoopMD"

/*
 Find the correct line.
 */
DETEC=0 ; PDRAW="" ; DFILE=""
CALL OPEN('MD','T:SnoopMD','R')
DO UNTIL DETEC>1 ; PDRAW=READLN('MD') ; DETEC=POS('DBX_',PDRAW) ; END
DFILE=READLN('MD') ; CALL CLOSE('MD') ; QUIT

/*
 Give it a hair cut
 */
TARGETFILE=TRIM(PDRAW)||"/"||TRIM(DFILE)

/*
 TARGETFILE
*/
DFILE=""
CALL OPEN('MDT',TARGETFILE,'R') ; CALL OPEN('MDHT','T:PARTONE','W')
DETEC=0
 DO UNTIL DETEC>0
  DFILE=READLN('MDT') ; CALL WRITELN('MDHT',DFILE)
  DETEC=POS('Mime-Version: ',DFILE)
 END
CALL CLOSE('MDT') ; CALL CLOSE('MDHT')

/*
 EDIT FILE
 */
DFILE=""
CALL OPEN('PRTO','T:PARTONE','R')
CALL OPEN('PRTT','T:MessHeldTarget','R')
CALL OPEN('MDT',TARGETFILE,'W')
DETEC=0
 DO UNTIL DETEC>0
  DFILE=READLN('PRTO') ; CALL WRITELN('MDT',DFILE)
  DETEC=POS('Mime-Version: ',DFILE)
 END
 DO UNTIL EOF('PRTT')
  DFILE=READLN('PRTT') ; CALL WRITELN('MDT',DFILE)
 END
CALL CLOSE('MDT') ; CALL CLOSE('PRTT') ; CALL CLOSE('PRTO')

ADDRESS COMMAND 'DELETE T:MessHeldTarget T:PARTONE QUIET'
ADDRESS COMMAND 'DELETE T:SnoopMD T:Messageheld QUIET'
EXIT
--- 8< --- Cut --- AREXX --- Here --- 8< ---

I hope you can find them of some use.

--
Regards
  Jules
_____________________________________________________________
NetConnect mailing list. To unsubscribe, send an 'unsubcribe'
message to <[EMAIL PROTECTED]>

Reply via email to