failat 9999999
changetaskpri 0

rx "exit show('p','JAMMAIL')"
if ${RC} eq 1
  echo "Killing Current Running JamMail!"
  rx >nil: "Address 'JAMMAIL' 'Abort'"
endif
rx "exit show('p','JAMMAIL1')"
if ${RC} eq 1
  echo "Killing Current Running Line 1!"
  rx >nil: "Address 'JAMMAIL1' 'Abort'"
endif
rx "exit show('p','JAMMAIL2')"
if ${RC} eq 1
  echo "Killing Current Running Line 2!"
  rx >nil: "Address 'JAMMAIL2' 'Abort'"
endif
rx "exit show('p','LOGPROC')"
if ${RC} eq 0
  run <NIL: >nil: logproc
  wait 2
  echo "Waiting for LogProc"
  waitforport LOGPROC
  rx "Address 'LOGPROC' 'OpenScreen JamLogs2 724 566 2 32772 0 0'"
  rx "Address 'LOGPROC' 'OpenLog jammailfile f Logs:JamMail.log'"
  rx "Address 'LOGPROC' 'OpenLog jammailwind w RAW:0/26/724/242/JamMail Log Window/inactive/SIMPLE/SCREENJamLogs2'"
  rx "Address 'LOGPROC' 'AddLogGroup JamMailLogs jammailwind jammailfile'"

  rx "Address 'LOGPROC' 'OpenLog jm-phonefile f logs:phone.log'"
  rx "Address 'LOGPROC' 'OpenLog jm-phonewindow w RAW:0/475/724/90/JamMail LongDistance Calls/inactive/SIMPLE/SCREENJamLogs2'"
  rx "Address 'LOGPROC' 'AddLogGroup JamMailPhone jm-phonefile jm-phonewindow'"
else
  Echo "Logging system already active"
endif
if NOT EXISTS logs:phone.log
  echo  >logs:phone.log "   Date     Time   Duration     Number    Type      Address        Location"
  echo >>logs:phone.log "--------- -------- -------- -------------- ---- ------------------- ---------"
endif
echo "Launching JAMMAIL"

newshell window=RAW:0/271/280/201/Setup/inactive/SIMPLE/SCREENJamLogs2 from s:setup.cli

