home *** CD-ROM | disk | FTP | other *** search
/ Amiga Magazin: Amiga-CD 1996 July / AMIGA_1996_7.BIN / patches / pagestream / 3.0cfupdate / macros.lha / cmdshell.rexx < prev    next >
OS/2 REXX Batch file  |  1994-04-20  |  2KB  |  60 lines

  1. /*
  2.  * cmdshell.rexx
  3.  *
  4.  *  This opens up a console window so the user can send arexx commands directly to an application.
  5.  *
  6.  */
  7.  
  8. options results
  9. options failat 100
  10.  
  11. open('console', 'CON:0/11/640/100/PageStream3/SCREEN PageStream3', 'RW')
  12. writeln('console', 'Enter commands, "Q" to exit.')
  13.  
  14. address 'PAGESTREAM'
  15.  
  16. /* loop until user exits */
  17. do forever
  18.  
  19.         /* get command string from user */
  20.         writech('console','CMD> ')
  21.         cmd=readln('console')
  22.  
  23.         select
  24.  
  25.                 /* time to quit? */
  26.                 when (upper(cmd) = "Q") then do
  27.                         leave
  28.                 end
  29.  
  30.                 /* need some help? */
  31.                 when (cmd = "?") then do
  32.                         writeln('console', 'Enter "Q" to exit.')
  33.                 end
  34.  
  35.                 /* do nothing on empty lines */
  36.                 when (cmd = "") then do
  37.                         nop
  38.                 end
  39.  
  40.                 /* process the line */
  41.                 otherwise do
  42.                         /* execute the command string */
  43.                         cmd
  44.  
  45.                         /* if ok show the result, if any */
  46.                         if (RC = 0) then do
  47.                                 if result ~= "RESULT" then writeln('console', result)
  48.                                 if (upper(cmd) = "QUIT") then leave
  49.                         end
  50.  
  51.                         else do
  52.                                 writeln('console', '*** Error');
  53.                         end
  54.                 end
  55.         end
  56. end
  57.  
  58. exit(0)
  59.  
  60.