4CONSOLE

May 20, 2008
12,035
127
Syracuse, NY, USA
I have a working @ATTRTOVT (comments welcomed). It uses "extended" sequences (available in up-to-date CONHOSTs) ...

30-37 dark foreground colors
90-97 bright foreground colors
40-47 dark background
100-107 bright background
2/24 underscore on/off
7/27 reversed on/off

As far as I know those are the only things you can get from console attributes. For now, I don't put the escape character in the sequence so I can actually see the result. But putting the escape character in the sequence does work.

One small pain in the ### was that attributes use 1, 2, 4 for blue, green, red while VT sequences use 1, 2, 4 (plus 30, 40, 90, 100) for red, green, blue.

It'll take decimal numbers also.

Here are a few examples.

1630092448886.png


These are also among the attributes but I don't think they translate into VT sequences.

#define COMMON_LVB_LEADING_BYTE 0x0100 // Leading Byte of DBCS
#define COMMON_LVB_TRAILING_BYTE 0x0200 // Trailing Byte of DBCS
#define COMMON_LVB_GRID_HORIZONTAL 0x0400 // DBCS: Grid attribute: top horizontal.
#define COMMON_LVB_GRID_LVERTICAL 0x0800 // DBCS: Grid attribute: left vertical.
#define COMMON_LVB_GRID_RVERTICAL 0x1000 // DBCS: Grid attribute: right vertical.
 
Aug 9, 2009
293
1
Thank you both Charles and Vince very much; Charles @readcolor works. Vince I can't see your @attrtovt as I'm guessing its not ready for ftp access

I'm going to have to rethink this as @filewrite hates escape character ^ caret
setdos /a1 /x-8 doesn't seem to work with ansi sequences
 
May 20, 2008
12,035
127
Syracuse, NY, USA
Thank you both Charles and Vince very much; Charles @readcolor works. Vince I can't see your @attrtovt as I'm guessing its not ready for ftp access

I'm going to have to rethink this as @filewrite hates escape character ^ caret
setdos /a1 /x-8 doesn't seem to work with ansi sequences
Should I put the escape character into @ATTRTOVT's output? That would cut down on problems with ^, but then you won't see the sequences if you just echo them.

I just updated the FTP site. For now, the escape character is not included in the sequence.
 
May 20, 2008
12,035
127
Syracuse, NY, USA
I gave the user the option to include the escape character (see pic below) and updated FTP a moment ago (00:15, US Eastern Daylight).

1630124369697.png
 
Aug 9, 2009
293
1
Nice works well. Thank you. plain old echo for now has to write the file caret and @filewrite don't play well together.
 
May 20, 2008
12,035
127
Syracuse, NY, USA
FYI, with the '+', @ATTRTOVT does not put '^e' at the beginning of the sequence; it puts the real thing there, ASCII character 27.
 
Aug 9, 2009
293
1
Code:
: # sample reads my console screen at row 4 length 34 by 3
: # works great
SETLOCAL
    set r=4
    function ansiseq=`%@attrtovt[%@colorat[%1,%2],+]%@readscr[%1,%2,2]%@char[27][30;40;0m`
set open_1=%@fileopen[Dummy.txt,w]

do c=0 to 34 by 3
    set w=%@filewriteb[%open_1,%@len[%@ansiseq[%r,%c] ],%@ansiseq[%r,%c] ]
enddo
set close=%@fileclose[%open_1]

ENDLOCAL
QUIT
: # Thank you vince

Everything is behaving