![[About]](e:\os2httpd_1.3.2\htdocs\rexxtipsntricks\about.gif)
![[Toc]](e:\os2httpd_1.3.2\htdocs\rexxtipsntricks\toc.gif)
0.9b (c) 1995 Peter Childs
/* sample routine to get the current cursor position with plain REXX */
/* and ANSI commands */
/* Original code is from the ANSICD package from Jamie Hoglund */
parse value GetCursorPos() with col row
say "At program start the cursor was at " || ,
"Column " || col || ", Row " || row || "."
exit 0
/* ------------------------------------------------------------------ */
/* function: Get the current cursor position */
/* */
/* call: GetCursorPos */
/* */
/* returns: col row */
/* */
/* note: This function works only for display sizes up to 200 for */
/* columns or rows. The upper left corner is 1,1. */
/* The REXXUTIL function SysCurPos uses zero based values */
/* (the upper left corner is 0,0). */
/* */
GetCursorPos: PROCEDURE
usedChars = ":;<=>?@ABCD"
Rc = Charout(,D2C(27) || "[6n")
Pull Q
/* v2.30 */
parse var q 3 y1 +1 y2 +1 3 row +2 6 x1 +1 x2 +1 6 col +2 .
if pos( y1, usedChars ) <> 0 then
row = 10 || y2
if pos( x1, usedChars ) <> 0 then
col = 10 || x2
return col row
Inf-HTML End Run - Successful