Kev wrote about 'Picturegrab script'
on 23 Mar 2002 10:18:22 +0100 
 
> Thanks for posting the script,

 Thanks for the response, I often get silence, so don't know if it worked
or not.

> I still use a script I wrote some time back which uses the ExtractSelectedmsgs
> command, maildecode and some other stuff..... I noticed you are using the latest
> mdII, I still use 1.4.4, does ExtractSelectedmsgs still work in the latest mdII
> do you know? 

 As far as I know it does, but I haven't used it for some time. I could use
the extract method with this script, I'll see if it's faster, thanks for
the nudge. :)

 This version will use DOpus progress requester if available.

 Sad news about Ben Hollioake wasn't it.
-- 8< --
/*
$VER: MD2picturegrab.rx 1.2 (20020323151101) 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. If you are running
DOpus5 it will use the DOpus progress bar.

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

IF ~EXISTS('C:'||CMAD.1) THEN DO
  ERRT='Could not find '||CMAD.1 ; CALL PROBLEMFOUND
END

/*
 Is DOpus running
 */
IF ~SHOW('P','DOPUS.1') THEN DO
  IF ~EXISTS('C:'||CMAD.2) THEN DO
    ERRT='Could not find '||CMAD.2 ; CALL PROBLEMFOUND
    EXIT
  END
  DOPUSP=0
END
ELSE DO
 ADDRESS DOPUS.1 DOPUS VERSION
 DV=RESULT ; DV=TRANSLATE(DV,'.',' ')
 IF  DV < 5.1218 THEN DOPUSP=0
                 ELSE DOPUSP=1
END

IF DOPUSP=0 THEN ADDRESS COMMAND "RUN >NIL: C:FreshBar"

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

IF DOPUSP=0 THEN DO
 ADDRESS FRESHBAR_REXX.1
 CREATEBARWINDOW "Pictures"
 WinHandle1 = RESULT
 ADDBAR WinHandle1 PICOUNT
 BarHandle1 = RESULT
 SETPROGRESSMODE WinHandle1 BarHandle1 2
 OPENBARWINDOW WinHandle1
END ; ELSE DO
 ADDRESS DOPUS.1
 DOPUS PROGRESS NAME BAR
 HANDLE=RESULT
 DOPUS PROGRESS HANDLE TITLE 'Picture grab by Jules'
 DOPUS PROGRESS HANDLE NAME  'Retrieving files form MD2'
END

CALL OPEN('DT','T:DETACH','R')
 DO UNTIL EOF('DT')
  COUNT=COUNT+1
  PDRAW=STRIP(READLN('DT'),'B')
  ADDRESS COMMAND PDRAW
  IF DOPUSP=0 THEN SETCURRENT WinHandle1 BarHandle1 COUNT
              ELSE DOPUS PROGRESS HANDLE BAR PICOUNT COUNT
 END
CALL CLOSE('DT')

/*
 Clean-up and leave
 */
IF USINGREQTOOLS~=1 THEN SAY 'Cleaning up.'
CALL PRAGMA 'D','SYS:'
IF DOPUSP=0 THEN DELETEBARWINDOW WinHandle1
            ELSE DOPUS PROGRESS HANDLE OFF
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
__________________________________________________________________
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