Hello All

 I hope this will be of some use.

-- 8< --
/*
$VER: MD2picturegrab.rx 1.1 (20 Mar 2002 16:48:04) by Jules
Jules < create AT clara co uk >

This script will attempt to strip any UU or base64 file
from news or Email messages in Microdot2 and save
it to a destination of your choosing.

Note:
 This script cannot handle attachments which have
 been split across more than one message. Nor will
 it handle yenc files.

This script requires the following.
Libraries:
 reqtools.library (v38.1413)
 rexxreqtools.library (v37.95)
 rexxsupport.library(34.9)
Commands:
 maildecoder (on http://uk.aminet.net/~aminet/dirs/aminet/util/cli/maildecoder.lha)
 FreshBar 1.1 (On Aminet/util/rexx/FreshBar.lha)
Programme:
 Snoopdos (Version >3)

Instructions:
 1) If 'Snoopdos' is not in your system path, enter the new path in this script.
 2) Select but do not open the first message, as the script will do that.
 3) If this scritp is run without arguments it will show a requester for you to
    enter the number of files to be read. Output is by default to 'RAM:'.
    (if run from shell -
     rx rexx:MD2picturegrab.rx [number of files [Path]])
 4) When it has finished, it will either print to a window or show a requester.

This script is used at your own risk.
*/

OPTIONS RESULTS
PARSE ARG PICOUNT PATH

/* Snoopdos Path */
SNOOP='SNOOPDOS'

USINGREQTOOLS=0
IF PICOUNT <1 THEN DO
 USINGREQTOOLS=1
 PICOUNT=1
 END

IF PATH >"" THEN
    FILEPATH=STRIP(PATH,'B')
  ELSE
    FILEPATH='RAM:'

/* Libraries */
LIBR.1='rexxreqtools.library'
LIBR.2='reqtools.library'
LIBR.3='rexxsupport.library'
CMAD.1='maildecoder'
CMAD.2='freshbar'

DO I=1 TO 3
 IF ~EXISTS('Libs:'||LIBR.I) THEN DO
  ERRT='Could not find '||LIBR.I ; CALL PROBLEMFOUND
 END
 ELSE DO
  IF ~SHOW('L',LIBR.I) THEN CALL ADDLIB('Libs:'||LIBR.I,0,-30,0)
 END
END
DROP I

DO I=1 TO 2
 IF ~EXISTS('C:'||CMAD.I) THEN DO
  ERRT='Could not find '||CMAD.I ; CALL PROBLEMFOUND
 END
 ELSE
 IF I=2 THEN ADDRESS COMMAND "RUN >NIL: C:FreshBar"
END ; DROP I

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

/* Is Microdot running */
IF ~SHOW('P','MD.1') THEN DO
 ERRT="Microdot is not running" ; CALL PROBLEMFOUND
END

IF USINGREQTOOLS=1 THEN DO
 CALL PUTTHEMHERE ; CALL HOWMANY
END

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

ADDRESS SNOOPDOS
FUNCTIONS NONE;NOONLYSHOWFAILS;NOSHOWCLI;NOMONITORPACKETS
NOPACKETDEBUGGER;NOMONITORROMCALLS;IGNORESHELL;NOUSEDEVICENAMES
NOSHOWFULLPATH;OPEN;FILEIOTYPE=BUFFERED;SHOWFULLPATH;CLEARBUFFER
MATCHNAME='microdot';FORMAT "%255n";LOGFORMAT "%255n";ENABLE
OPENLOG "T:SnoopMD"

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

ADDRESS COMMAND 'WAIT'
ADDRESS SNOOPDOS;DISABLE;QUIT
ADDRESS COMMAND 'WAIT'

IF ~EXISTS('T:SnoopMD') THEN DO
 ERRT='Could not find SnoopMD' ; CALL PROBLEMFOUND
END

/* Find the correct line. */
DETEC=0;PDRAW="";PICOUNT=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
   PDRAW='C:maildecoder '||PDRAW||' quiet >NIL:'
   CALL WRITELN('DT',PDRAW)
   PICOUNT=PICOUNT+1
  END
 END
END
CALL CLOSE('MD')
CALL CLOSE('DT')

COUNT=0
ADDRESS "FRESHBAR_REXX.1"
CREATEBARWINDOW "Pictures"
WinHandle1 = RESULT
ADDBAR WinHandle1 PICOUNT
BarHandle1 = RESULT
SETPROGRESSMODE WinHandle1 BarHandle1 2
OPENBARWINDOW WinHandle1
CALL OPEN('DT','T:DETACH','R')
 DO UNTIL EOF('DT')
  COUNT=COUNT+1
  PDRAW=STRIP(READLN('DT'),'B')
  ADDRESS COMMAND PDRAW
  SETCURRENT WinHandle1 BarHandle1 COUNT
 END
CALL CLOSE('DT')

IF USINGREQTOOLS~=1 THEN SAY 'Cleaning up.'
CALL PRAGMA 'D','SYS:'
DELETEBARWINDOW WinHandle1
CALL DELETE('T:DETACH')
CALL DELETE('T:SnoopMD')
IF USINGREQTOOLS=1 THEN CALL rtezrequest("Completed","Thank you","I have finished.")
 ELSE SAY 'Complete.'

EXIT

PUTTHEMHERE:
FILEPATH = RTFILEREQUEST('RAM:',,"Destination ?","Alright","rtfi_flags=freqf_nofiles")
IF RTRESULT==0 THEN EXIT
RETURN

HOWMANY:
NL = '0a'x
CALL RTGETLONG('1','How Many Messages'NL'do you wish to open',
,'Get attachments by Jules',"_Yes please|_No thank you",'RTGL_MIN=1 RTGL_MAX=500')
IF RTRESULT~=1 THEN EXIT
PICOUNT=RESULT
RETURN

PROBLEMFOUND:
IF USINGREQTOOLS=1 THEN CALL RTEZREQUEST(ERRT, "Shame", "Error!");ELSE SAY ERRT
EXIT
RETURN

-- 8< --

--
Regards

  Jules
--
Mud is not one of the 4 food groups
-- Bart Simpson
__________________________________________________________________
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