home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rdebug21.zip / CHORES.CMD next >
OS/2 REXX Batch file  |  1993-03-23  |  5KB  |  198 lines

  1. /*H* CHORES.REX 12-24-92 09:56 */
  2.  Parse Arg prog parms
  3.  prog=translate(prog)
  4.  me=prog
  5.  Parse source sys .
  6.  sys.=0
  7.  if      sys='OS/2'  then sys.os2=1
  8.  else if sys='PCDOS' then sys.dos=1
  9.  If arg(1)=? Then Exit tell(me)
  10.  i=lastpos('\',prog)
  11.  If i>0 Then prog=substr(prog,i+1)
  12.  again?=0
  13.  Call find_program parms
  14.  Exit
  15.  FIND_PROGRAM:
  16.  Signal On syntax /*trap unknown program*/
  17.  Signal Value prog
  18.  SYNTAX:
  19.  If again? Then Say 'Coding error in program' prog
  20.  Else Say "program" prog "not found in CHORES"
  21.  again?=1
  22.  Exit
  23.  
  24.  BKUP:
  25.  Trace o?r
  26.  call bkupa
  27.  call bkupc
  28.  exit
  29.  
  30.  BKUPA:
  31.  Trace o?r
  32.  If parms='' Then parms=0
  33.  Parse Value parms With dayssincebkup ext
  34.  Say 'Doing backup of a: Drive:'
  35.  say '   Please insert backup disk in drive b:'
  36.  'cd b:\'
  37.  do n=1
  38.    say '   Please insert original disk in drive a:'
  39.    Say '      Hit enter to continue or'
  40.    Say '      N to exit'
  41.    ans=translate(inkey())
  42.    if ans='N' then leave
  43.    'c:\bin\pcopy a:\*.* b:\ /d:)'dayssincebkup+2'/dc/b/ba/s/nw/ex/np/u/o:*.BAK,*.AUS,AA*.*,*.LOG,*.DIR'
  44.    'dir b:\*.'
  45.  End
  46.  'cd \'
  47.  'c:'
  48.  
  49.  return; BKUPC:
  50.  If parms='' Then parms=0
  51.  Parse Value parms With dayssincebkup ext
  52.  Say 'Doing backup of C Drive, please insert backup disk in drive a:'
  53.  'cd a:\'
  54.  Do 1
  55.    Say '      Hit enter to continue or'
  56.    Say '      N to exit'
  57.    ans=translate(inkey())
  58.    if ans='N' then leave
  59.    'C:\BIN\PCOPY C:\*.* A:\ /D:)'dayssincebkup+2'/DC/B/BA/S/NW/EX/NP/U/O:*.BAK,'EXT',*.AUS,AA*.*,*.LOG,*.DIR,SWAPPER.DAT'
  60.    'dir a:\*.'
  61.  End
  62.  'cd \'
  63.  'c:'
  64.  return;
  65.  date=date('o')
  66.  date='ZZ'left(date,2)substr(date,4,2)right(date,2)
  67.  
  68.  return; CATDISK:
  69.  Arg filespec
  70.  drive=dosdrive()
  71.  i = pos(':',filespec)
  72.  If i=2 Then Do
  73.    drive=left(filespec,1)
  74.    filespec=substr(filespec,3); End
  75.  Queue 'c:\bin\w.exe' drive':'filespec
  76.  
  77.  Return; CHAIN:
  78.  fid = 'e:\chain.bat'
  79.  Call dosdel(fid)
  80.  Call lineout fid
  81.  If trace()<>'?R'
  82.  Then sw='off'
  83.  Else sw='on'
  84.  Call lineout fid, '@echo' sw
  85.  Call lineout fid, 'set pr=%PROMPT%'
  86.  Call lineout fid, 'SET PROMPT=[Type EXIT To return]$p$g'
  87.  Do n=1 While l.n<>''
  88.    Call lineout fid, l.n
  89.  End
  90.  Call lineout fid, 'SET PROMPT=%pr%'
  91.  Call lineout fid, 'set pr='
  92.  /*call lineout fid, 'call reset.bat'*/
  93.  Call lineout fid, sourcedrive':'
  94.  Call lineout fid, 'cd' Source
  95.  Call lineout fid
  96.  Queue fid
  97.  
  98.  Exit; COPYL:  /* COPY FILES FROM SOURCE DATED WITHIN THE LAST 2 DAYS ONLY */
  99.  Arg p1 p2 p3 p4 p5
  100.  If p1='' Then p1='b:*.*'
  101.  If p2='' Then p2='c:\test\'
  102.  /* calculate yesterday */
  103.  date=date('O')
  104.  day=substr(date,7,2)-1
  105.  mo=substr(date,4,2)
  106.  yr=substr(date,1,2)
  107.  If lt? Then Say 'Mount disk in drive b:'
  108.  'c:\dos\xcopy' p1 p2 '/p /s /D:'mo'-'right(day,2,0)'-'yr
  109.  
  110.  Exit; GST:
  111.  traCE o?R
  112.  l.1='c:'
  113.  l.2='cd \123'
  114.  l.3='c:\rexx\press.exe' 'DELAY 2 /FR CURR CURR CURR ENTER'
  115.  l.4='123'
  116.  Call chain
  117.  /*push 'b prog 123'
  118.  exit*/
  119.  
  120.  HIST:
  121.  Say "    Do you wish To run family history? (Y/N)"
  122.  Do 10
  123.    Call delay .5
  124.    ans=inkey('N')
  125.    If ans<>'' Then Leave
  126.  End
  127.  If upper(ans)='Y' Then Queue 'faminit'
  128.  
  129.  Exit; LISTMACS:
  130.  f = 'c:\ram2\macs.bat'
  131.  macs =
  132.  Call lineout f
  133.  Say '                  DOSKEY MACROS'
  134.  Do Forever While lines(f)
  135.    n=1
  136.    Do Forever While lines(f)
  137.      line=linein(f)
  138.      If word(line,1) <> 'e:doskey' Then Iterate
  139.      word= word(line,2)
  140.      word=word(translate(word,' ','='),1)
  141.      macs= macs left(word,8)
  142.      n=n+1
  143.      If n>8 Then Leave
  144.    End
  145.    Say  macs
  146.    macs=
  147.  End
  148.  Say  macs
  149.  
  150.  Exit; PCTBKUP:
  151.  Say "Before running BACKUP you must have run WARM and REM'ed out SMARTDRV"
  152.  Say 'Do you want To continue? Y/N'
  153.  Pull ans
  154.  If ans = 'Y' Then Do
  155.    Queue 'set pctools=c:\pctbkup\files'
  156.    Queue 'set cptmp=e:\'
  157.    Queue 'c:\bin\release last.tsr'
  158.    Queue 'c:\bin\release misc.tsr'
  159.    Call program 'd:\pctbkup\pcbackup.exe c:'
  160.  End
  161.  
  162.  Exit; PRTSPOOL:
  163.  If state('c:\spool\*.*')=0 Then Queue ' C:\rexx l.rex print c:\spool\*.*'
  164.  Exit; SPELL:
  165.  Arg fileid '/'editor
  166.  Call dosdrive sourcedrive':'
  167.  Call doschdir Source
  168.  editor='WP'
  169.  If editor='' Then Do
  170.    SAY 'WHAT EDITOR: WP OR PCTOOLS? (WP IS DEFAULT)'
  171.    Pull editor; End
  172.  If editor='PCT' Then Do
  173.    file='spell.ovl'
  174.    If lines('e:'file) = 0 Then 'copy d:\pct\'file 'e:'file '>nul'
  175.    Push  ' d:\pct\desktop'
  176.    ' d:\rexx\press.exe' 'ENTER' fileid 'ENTER F7'; End
  177.  Else Do
  178.    Push  ' d:\WP\WP.exe' fileid
  179.    ' d:\rexx\press.exe' 'C-F2 3 ENTER'; End
  180.  
  181.  Exit; STATE:
  182.  Arg specs
  183.  If pc? Then Do
  184.    If dosdir(specs)='' Then rc=28
  185.    Else rc=0; End
  186.  Else 'STATE' specs
  187.  
  188.  Return rc; THES:
  189.  Exit msg(me,10,"Not working now")
  190.  Arg fileid
  191.  Push 'c:\WP\WP.exe' fileid
  192.  'd:\rexx\press.exe' 'A-F1'
  193.  
  194.  Exit;  USE:
  195.  Push macro use
  196.  Push 'x lasting.glv'
  197.  Exit
  198.