home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 13 / AACD13.ISO / AACD / Utilities / QuickFile / ARexx / Console.quickfile < prev    next >
Text File  |  2000-06-11  |  2KB  |  91 lines

  1. /*
  2. $VER: Console.quickfile 1.4 (12 Jun 2000  00:03:41) by M Andre Z Eckenrode
  3.  
  4. Opens a console window in which ARexx and other macro commands may be typed and
  5. executed. The current address port is indicated by the prompt. The size and
  6. position of the window may optionally be customized by providing the following
  7. arguments:
  8.  
  9.   <left edge> <upper edge> <width> <height>
  10.  
  11. The following default values are used for any missing arguments:
  12.  
  13.   120 85 400 100
  14.  
  15. */
  16.  
  17. options results
  18. options failat 100
  19.  
  20. arg win.x win.y win.w win.h .
  21. if win.h = '' then win.h = 100
  22. if win.w = '' then win.w = 400
  23. if win.y = '' then win.y = 85
  24. if win.x = '' then win.x = 120
  25.  
  26. call close('STDOUT')
  27. call open('STDOUT',"CON:"win.x"/"win.y"/"win.w"/"win.h"/QuickFile ARexx Console - Type 'Q' to quit/wait",'rw')
  28.  
  29. mainloop:
  30.  
  31.     signal on halt
  32.     signal on ioerr
  33.     signal on syntax
  34.  
  35.     do forever
  36.         writech('STDOUT',''address()'> ')
  37.         cmd = readln('STDOUT')
  38.  
  39.         select
  40.             when upper(cmd) = 'Q' then call halt
  41.             when cmd = '' then nop
  42.             otherwise do
  43.                 cmd = cmd'; qfrc = rc; qfresult = result'
  44.                 call checkinst
  45.                 interpret cmd
  46.                 if qfrc < 20 then do
  47.                     if qfresult ~= 'RESULT' then do
  48.                         say 'QFResult =' qfresult
  49.                         result = 'RESULT'
  50.                     end
  51.                 end
  52.                 if qfrc ~= 0 then do
  53.                     /* For some reason, the SAY and ECHO instructions cause RC to be set to 12 here */
  54.                     if qfrc ~= 12 & pos('SAY ',upper(cmd)) = 0 & pos('ECHO ',upper(cmd)) = 0 then do
  55.                         say 'QFRC =' qfrc
  56.                         say '*** QuickFile Error ***'
  57.                     end
  58.                 end
  59.             end
  60.         end
  61.     end
  62.  
  63. halt:
  64.     say '   Halted...press CTRL+\ to close'
  65. exit
  66.  
  67. syntax:
  68.     say 'Oops....   'errortext(qfrc)
  69. signal mainloop
  70.  
  71. ioerr:
  72.     say 'IO error.'
  73. signal mainloop
  74.  
  75. checkinst: procedure expose cmd
  76.     inst.1 = 'UPDREC'
  77.     inst.2 = 'NEXT'
  78.     inst.3 = 'DOSEARCH'
  79.     inst.4 = 'GOTO'
  80.     inst.5 = 'SHOWALL'
  81.     inst.6 = 'INSREC'
  82.     inst.7 = 'DELREC'
  83.     
  84.     do i = 1 to 7
  85.         if pos(inst.i,upper(cmd)) > 0 then do
  86.             cmd = cmd'; refresh'
  87.             leave
  88.         end
  89.     end
  90. return
  91.