Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

cscript strips escape character

77 views
Skip to first unread message

Paul Casey

unread,
Jan 6, 2001, 9:10:22 AM1/6/01
to
Has any one noticed that if you write an escape sequence (eg Chr(27) &
"[2j") to stdout, that Cscript seems to strip the escape and replace it with
a "<" character. I'm trying to write the escape sequences for a vt100
terminal.

Thanks,

Paul


Tom Lavedas

unread,
Jan 8, 2001, 10:11:02 AM1/8/01
to

A code snippet, please - I've never seen this behavior. Are you writing
it to an ASCII file type (not a Unicode type)? Reading it back in for
debugging using a simple string read? If it is the latter, you will get
faulty results because of the translation to Unicode within the Windows
GUI. Handling binary codes, like 'pure' ASCII, can be very tricky
because of that translation. Seeing some code would be helpful in
tailoring a solution to your specific needs.

Tom Lavedas
-----------
http://www.pressroom.com/~tglbatch/

Paul Casey

unread,
Jan 8, 2001, 3:24:50 PM1/8/01
to
The following sequence if executed via a terminal emulator (and telnet
server), should issue a Clear Screen to a VT100 terminal. My terminal
emulator shows that the Microsoft logo issues this sequence correctly, but
the CHR(27) that I am writing is getting translated to a > character.

MyString = CHR(27) & "[2J"
wscript.stdout.write MyString

Strange....

Paul
Tom Lavedas <lav...@pressroom.com> wrote in message
news:3A59D886...@pressroom.com...

Tom Lavedas

unread,
Jan 9, 2001, 9:10:24 AM1/9/01
to
That is strange, because it works exactly as you wrote it in a standard
console for me in Win 98. I didn't stop to try it in NT.

Just because it's easy (not because it should make any difference), try
...

set oStdOut = wscript.stdout
MyString = "[2J"
oStdOut.write ChrB(27)
oStdOut.write MyString

Michael Harris reports that the direct use of WScript.StdOut works
differently in some instances as compared to the use of the object
defined in a SET statement. I can't remember the details. I have also
thrown in a literal definition of the escape character as a byte for
good measure.

As I said, I don't see why this should help, but I have nothing else to
suggest.

Steve Fulton

unread,
Jan 9, 2001, 8:23:26 AM1/9/01
to
Capturing the output to a text file reveals an escape character. Something
else must be going on. Could the escape be getting munged by the telnet
process?

I haven't worked on a VT100 terminal in quite a while, but I seem to recall
they can be set into debug mode, where escapes are translated into
displayable characters.

=-=-=
Steve
-=-=-

"Paul Casey" <pca...@pdauk.com> wrote in message
news:%Qp66.23026$nu5.128588@NewsReader...

Paul Casey

unread,
Jan 9, 2001, 1:43:11 PM1/9/01
to
Steve,

The telnet process is where I first started looking, however it doesn't
crunch the sequences sent by the MS Logo, so I don't think that's it. But
thanks anyway.

Paul
Steve Fulton <cerbe...@hotmail.com> wrote in message
news:uq5JtlkeAHA.1308@tkmsftngp05...

Paul Casey

unread,
Jan 9, 2001, 1:50:28 PM1/9/01
to
Tom,

Thanks, -- I didn't get the ChrB(29) -- It just didn't show up... Weird.
You're right though, I need to try it under 9x and see if it does something
different.
My emulator showed the following:

1B[4;1H That's the MS bit to position the cursor
[2J That's MyString
1B[4;4H That's the next MS bit to reposition the cursor.

Paul

Tom Lavedas <lav...@pressroom.com> wrote in message

news:3A5B1BD0...@pressroom.com...

Paul Casey

unread,
Jan 12, 2001, 2:49:07 PM1/12/01
to
The answer came from an obscure msdn article about console applications.
The message is:

Windows NT does not support ANSI escape sequences.

NT will strip out any escape sequences. In order to do cursor positioning,
you need to use API functions.

Thanks anyway,

Paul

Paul Casey <pca...@pdauk.com> wrote in message

news:1JF56.11471$nu5.105274@NewsReader...

0 new messages