Stefan Schikora worte on 11 Feb 2000 12:43:34 +0100
about [md-2] Re: Cookies

> Oh, ql. I`m waiting till you are happy :)

  At the moment you have to add them individually from the 'message list
window' in the 'spool', I wouldn't trust it being attached to the send, but I'll
test that. This is the only safe way to do it, if you let Microdot update any of
it's indexes, you loose the message, so this way Microdot is only asked to read
the message, and the tagline is added without it 'knowing'.
  You can use a tagline list with the same format as the one used by 'YAM'. The
only things you need to alter in the script are, the path to the taglines and
'Snoopdos'.

--- 8< --- cut here --- 8< ---
/*
  $VER: V1.02 TAGon.mdrx (09-Feb-2000)
  $AUTHOR: Jules (JA888) �2000
  You need to say where your 'taglines' are kept,
  and the path to 'Snoopdos'
  */

/*
 Path to tag line list
 */
TAGLINES="NetConnect3:.taglines"

/*
 And the path of Snoopdos. Example SNOOP="SYS:Tools/Snoopdos"
 */
SNOOP="SNOOPDOS"

/*
 Check that Microdot is running
 */
IF ~SHOW('P','MD.1') THEN DO
    EXIT
    END

/*
 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)

/*
 Setup some counters
 */
CA=0 ; RA=0

/*
 How long is it?
 */
CALL OPEN('TGL',TAGLINES,'R')
DO UNTIL EOF('TGL')
  TFILE=READLN('TGL')
  IF TFILE="%%" THEN DO
    CA=CA+1
  END
END
CALL CLOSE('TGL')

/*
 Get a random number.
 */
RA=RANDOM(0,CA,TIME('S'))

/*
 Move to that point in the file
 */
CA=0
CALL OPEN('TGL',TAGLINES,'R')
DO UNTIL CA = RA
  TFILE=READLN('TGL')
  IF TFILE="%%" THEN DO
    CA=CA+1
  END
END

/*
 Tag it on
 */
CA=0
CALL OPEN('TAG',TARGETFILE,'A')
TGFILE.CA=""
DO UNTIL TGFILE.CA="%%"
  CALL WRITELN('TAG',TGFILE.CA)
  CA=CA+1
  TGFILE.CA = READLN('TGL')
END

/*
 Tidy up
 */
CALL CLOSE('TGL')
CALL CLOSE('TAG')

/*
 Get out of here
 */
EXIT
--- 8< --- and here --- 8< ---

Have fun

--
Regards
  Jules

The best laid plans of mice and men are usually about equal.

Reply via email to