[Info-vax] escape sequences, cursor positioning
DJ
daryljones at att.net
Sun Jan 11 08:33:14 EST 2009
On Jan 11, 12:49 am, acid.fri... at yahoo.de wrote:
> hi everybody,
> it might be interesting for you to read my previous topic:http://groups.google.com/group/comp.os.vms/browse_thread/thread/37b3e...
>
> in the meantime i managed to get a copy of vt100 user guide and i've
> read the programmers part very carefully, because i want to code
> something in DCL using ASCII escape sequences.
> i've found out that some escape seqences work very well and other
> don't work and now i'm trying to find some help here.
>
> $ ty specfont.com
> $!------------------------------------------------------------------------------
> $! PLAYING WITH ESC
> SEQUENCES
> $!------------------------------------------------------------------------------
> $!
> $ esc[0,7] = 27
> $ say = "write sys$output"
> $ say esc+ "(0"
> $ say " ssssssssss"
> $ say esc+ "(A"
> $ say esc+ "[3A"
> $ read sys$command input1/prompt=" "
>
> this works fine ^^
>
> but when i modify the "$ say " ssssssssss" line and add a additional
> escape seqence, it won't work.
>
> $ ty specfontv2.com
> $!------------------------------------------------------------------------------
> $! PLAYING WITH ESC
> SEQUENCES
> $!------------------------------------------------------------------------------
> $!
> $ esc[0,7] = 27
> $ say = "write sys$output"
> $ say esc+ "(0"
> $!
> $! modified line below, added some spaces in front of the first s
> $ say " ssssssssss"
> $!
> $ say esc+ "(A"
> $ say esc+ "[3A"
> $!
> $! additional escape sequence below, want the cursor so move right
> (this won't work)
> $ say esc+ "[2C"
> $!
> $ read sys$command input1/prompt=" "
>
> okay, that's my first problem.
>
> besides i don't want the underscores/special characters to get
> overwritten when i start typing.
> is there any easy solution for this?
>
> kind regards
Yes, this was done many moons ago when there wasn't any method
available to do it. I still use it today from time to time. There are
some start up command lines in "VAX/VMS Writing real Programs in DCL."
on page 76-81. Set your terminal to be 80 by 24 or 132 by 40. You must
turn off or set the last two lines on the screen to the scrolling
region. Next setup some subroutines for your repetative calls like
clear line or clear screen or move up or move down, or move left or
move right, and etc. You need to set your origin to be 0,0 on the
screen and move there. Now you should be set up to do what you would
like to do.
Use a variable to hold your question, for instance: line_out = "Please
enter your name: "
Next you get the length of the line by f$length(line_out). Please
notice I left a space at the end of the question in the line_out
variable.
Therefore, I would do the following and remembering that I am at the
origin of 0,0:
line_out = "Please enter your name: "
lo_len = f$length (line-out)
Write sys$output line_out
call move (0,lo_len)
Read sys$command input1
Or
line_out = "Please enter your name: "
Read sys$command /prompt=line_out input1
$ Move:
$ Subroutine
$ x = 'p1'
$ y = 'p2'
$ esc[0,8] = %x1B
$ csi = esc + "["
$ xy = csi + x + ";" + y + "H"
$ Write sys$output xy
$ exit
$ endsubroutine
With the call move routine you can move anywhere on the screen.
Line 23 and 24 were used for the error statements being displayed.
After the "Enter" key or "Return" key was depressed you would call the
move return to go back to the line where the line occurred and have it
clear the entry and wait for the correct response to occur.
I hope this helps!
Regards,
Daryl Jones
More information about the Info-vax
mailing list