.bra {
.ket }
.key STEP/S,TIMES/F


; /*     $VER: MailCheck 1.3 (01.07.97)       */
; /*                                          */
; /*   e-mail retreival with Miami and YAM    */
; /*                                          */
; /*  This script is part of MailCheck v1.3 	*/
; /*    and may not be modified or copied     */
; /*  without the authors written permission  */
; /*                                          */
; /*   ©1997 DCS Softwate by Robert Wilson    */


failat 25 

if $MCMailRun eq "1"
  skip End
else
  setenv MCMailRun 1
endif

if not exists libs:reqtools.library
  echo "MailCheck requires reqtools.library"
  skip END
endif

if not exists libs:rexxreqtools.library
  echo "MailCheck requires rexxreqtools.library"
  skip END
endif

if not exists libs:rexxtricks.library
  echo "MailCheck requires rexxtricks.library"
  skip END
endif

if not exists MailCheck:C/OkayDokey
  echo "Can't find OkayDokey in MailCheck:C/"
  skip END
endif

if not exists MailCheck:C/Wait
  echo "Can't find Wait in MailCheck:C/"
  skip END
endif

if not exists c:CheckModem
  echo "Can't find CheckModem in Sys:C/"
  skip END
endif

if not exists c:Play16
  echo "Can't find Play16 in Sys:C/"
  skip END
endif

; Check for STEP switch
 
if "{STEP}" eq "STEP"
  if "{TIMES}" eq ""
  setenv MCStepValue 2 
  endif
endif
 
if "{STEP}" eq "STEP"
  if "{TIMES}" NOT EQ ""
  setenv MCStepValue "{TIMES}"
  endif
endif

if "{STEP}" not eq "STEP"
  if "{TIMES}" eq ""
  setenv MCStepValue 1 
  endif
endif

if "{STEP}" not eq "STEP"
  if "{TIMES}" not eq ""
  setenv MCStepValue "{TIMES}"
  endif
endif

if val $MCStep not ge $MCStepValue
  eval $MCStep + 1 to Env:MCstep
  skip END
else
  setenv MCMaxTime 0
  setenv MCMTRun 1
  setenv MCReturn 0
  sys:rexxc/rx MailCheck:Rexx/MailCheck.rexx 
endif

if $MCReturn eq 0
  if exists MailCheck:User_Scripts/User_Script_07
    execute MailCheck:User_Scripts/User_Script_07
  endif
else
  setenv MCStep 1  
endif

lab WriteLog

sys:rexxc/rx 'say d2c(09)' >env:tab

echo "$MCDay$tab$MCDate$tab$MCTime$tab$MCDuration$tab$MCIn$tab$MCOut$tab$MCMessage" >> MailCheck:MailCheck.log

if exists MailCheck:User_Scripts/User_Script_08
  execute MailCheck:User_Scripts/User_Script_08
endif

lab END

setenv MCMailRun 0

quit
