home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / ansicd.zip / ansialt.cmd next >
OS/2 REXX Batch file  |  1994-12-30  |  3KB  |  104 lines

  1. /* Rexx */
  2. /* Ansicode2 - Another way to do it. */
  3. Say Cls()
  4. Call Charout,Locate(5,1)
  5. Say "This is an alternative method of controlling the screen I/O"
  6. Say "With "Csrattrib("Reverse")"Ansii"Csrattrib("Normal")" Codes."
  7. Say " "
  8. Say "Insead of Calling the procedure, you display it's "Csrattrib("Normal")"Output."
  9. Say Csrattrib("Normal")
  10. Say "I Find it easier to use."
  11. Say ""
  12. Say "If you have the "COLOR("RED")"Egrep"COLOR("WHITE")" Program, this will Display an index of it's procedures."
  13. Say ""
  14. Say "I can be reached at: "Csrattrib("High")"jhoglund@cscns"Csrattrib("Normal")" Or Compuserve "Csrattrib("High")"70244,3234"Csrattrib("Normal")
  15. Say ""
  16. Say "PRESS 'Y' if you have "CSRATTRIB("HIGH")"Egrep"CSRATTRIB("Normal")" And You would like an index"
  17. Pull Q
  18. If Q = "Y" Then Do
  19. PARSE SOURCE J1 J2 FIL Garbage
  20. Say "File: "Fil
  21. '@EGrep -i "^[A-z]" 'FIL' | Egrep ":" | Egrep "\*" | more '
  22. end
  23. Exit
  24.  
  25. /* ---------------- Cut Here -------------------------*/
  26. /* Ansi Procedures for moving the cursor */
  27. Locate: Procedure   /*  Say  Locate(Row,Col) */
  28. Row = arg(1)
  29. Col = Arg(2)
  30. return D2C(27)"["Row";"col"H"
  31.  
  32. CsrUp: Procedure  /* Say CsrUp(Rows) */
  33. Arg u
  34. return D2C(27)"["u"A"
  35.  
  36. CsrDown: Procedure /* Say CsrDn(Rows) */
  37. Arg d
  38. return D2C(27)"["d"B"
  39.  
  40. CsrRight: Procedure  /* Say CsrRight(Cols) */
  41. arg r
  42. Return D2C(27)"["r"C"
  43.  
  44. CsrLeft: procedure  /* Say CsrLeft(Cols) */
  45. arg l
  46. Return D2C(27)"["l"D"
  47.  
  48.  
  49. /*
  50. A------------------------------------------------------------:*
  51. SaveCsr and PutCsr are meant to be used together for saving  :*
  52. and restoring the cursor location. Do not confuse            :*
  53. with Locate, CsrRow, CsrCol, these are different routines.   :*
  54. SaveCsr Returns a string that PutCsr can use.                :*
  55. A:*/
  56. SaveCsr: procedure  /* cursor_location = SaveCsr() (for PutCsr(x))*/
  57. Rc = Charout(,D2C(27)"[6n")
  58. Pull Q
  59. Call CsrUp
  60. return Q
  61.  
  62. PutCsr: procedure  /* Call PutCsr <Previous_Location>  (From SaveCsr() ) */
  63. Where = arg(1)
  64. return substr(Where,1,7)"H"
  65. /*
  66. A:*/
  67. /* clear screen :*/
  68. Cls: Procedure      /* Say cls() */
  69. return D2C(27)"[2J"
  70.  
  71.     /* get cursors Line */
  72. CsrRow: Procedure      /* Row = CsrRow()*/
  73. Rc = Charout(,D2C(27)"[6n")
  74. Pull Q
  75. Return substr(Q,3,2)
  76.  
  77.    /* get cursors column */
  78. CsrCol: Procedure          /*  Col = CsrCol()  */
  79. Rc = Charout(,D2C(27)"[6n")
  80. Pull Q
  81. return Substr(Q,6,2)
  82.  
  83. /* procedure to color screen
  84. A:--------------------------------------------------------------*
  85. accepts colors: BLACK RED GREEN YELLOW BLUE MAGENTA CYAN WHITE  *
  86. */
  87. Color: Procedure /* Say Color(<ForeGround>,<BackGround>) */
  88. arg F,B
  89. Colors = "BLACK RED GREEN YELLOW BLUE MAGENTA CYAN WHITE"
  90. return D2C(27)"["WORDPOS(F,COLORS)+29";"WORDPOS(B,COLORS)+39";m"
  91.  
  92. /*  change screen attributes
  93. A:---------------------------------------------------------------*
  94. attributes: NORMAL HIGH LOW ITALIC UNDERLINE BLINK RAPID REVERSE *
  95. */
  96. CsrAttrib: Procedure  /* Say  CsrAttrib(<Attrib>) */
  97. Arg A
  98. attr = "NORMAL HIGH LOW ITALIC UNDERLINE BLINK RAPID REVERSE"
  99. return D2C(27)"["WORDPOS(A,ATTR) - 1";m"
  100.  
  101. EndAll:
  102. Call Color "White","Black"
  103. CALL CsrAttrib "Normal"
  104.