/* This adds the dmstxt but uses execio from Wshell by Bill Hawes! */
/* SpaZm... Scoopex... 407 639-9123 */

/* adds my dmstext to dms files */

YES = 1
NO = 0
TRUE = YES
FALSE = NO
/*
  to change the text forthe dms file use:
  DTC -s s:warpsig -d s:dmstext.dms

*/

RED_C    = '1B 5B 33 37 6D'x
RESET_C  = '1B 5B 30 6D'x
LF = '0A'x
dms_total  = 0
warp_total = 0


arg root

if length(root) == 0 then root = upper(pragma('D'))
if right(root,1) ~= ':' then
   if right(root,1) ~= '/' then   root = root || '/'

'set dateformat=0'
/* if you are using the CBM list cmd use #? instead of * */
call do_dms
call do_lharc
exit

do_lharc:
call yes_no("Do Todays Lharc files?")
if RESULT == TRUE then do
  Say 'Looking at Todays Lharc files'
  'list 'root'*.lzh since today dates quick files nohead | execio stem out.'
  end
else do
  say "Enter File names or wild cards (*)etc."
  pull wild
  if length wild == 0 then return
  Say 'Looking 'wild
  'list 'root || wild' dates quick files nohead | execio stem out.'
  say out.0
  if out.0 == 0 then return
  do i = 1 to out.0
     say out.i
  end
  call yes_no("Do these ?")
  if RESULT == FALSE then return
end
say "working on Lharc "out.0 " FILES in dir "root

do i = 1 to out.0

  "Lharc a "root || word(out.i,1)" s:Spazm.txt.displayme"   /* add my bbs ad */
  Say "Adding Text to DMS file"
 end

return


do_dms:
call yes_no("Do Todays DMS files?")
if RESULT == TRUE then do
  Say 'Looking at Todays DMS files'
  'list 'root'*.dms since today dates quick files nohead | execio stem out.'
  end
else do
  say "Enter File names or wild cards (*)etc."
  pull wild
  if length wild == 0 then return

  Say 'Looking 'wild
  'list 'root || wild' dates quick files nohead | execio stem out.'
  say out.0
  if out.0 == 0 then return
  do i = 1 to out.0
     say out.i
  end
  call yes_no("Do these ?")
  if RESULT == FALSE then return
end

if out.0 == 0 then do
   Say "No Dms files to do"
   return
   end

say "working on DMS "out.0 " FILES in dir "root

do i = 1 to out.0

  "DTR_V0.5 "root || word(out.i,1)  /* remove text file file to ram: */
  Say "Adding Text to DMS file"

  /* add my text to the file */
  'Join 'root || word(out.i,1) 's:dmstext.dms to ram:'word(out.i,1)
  /* copy ram: file back to drive */
  'copy ram:'word(out.i,1) root
   /* delete the file in ram after copying */
  call Delete('ram:'word(out.i,1))

  /* reset date back to real date & time it was uploaded */
  x = 'setdate 'root || word(out.i,1) word(out.i,2) left(word(out.i,3),5)
  ADDRESS COMMAND X
end
dms_total = out.0
return


