Quote:
>Hi all!
>I am interested in finding out how you can grab a portion of a text-mode
>screen and save it to an array, then to a file.
>I think I could use the SCREEN statement to do it, but don't have the
>actual info.
>By the way, I need to save a portion of the screen, not the whole (I know I
>can use BSAVE with that).
>Thanks in advance!
In this demo, I copied the full 80 char line but that is not required.
You can jump to various row, col locations with LOCATE and copy the
number of chars required from that location.
Although the 0 is not required with SCREEN(row, col, 0) to get the ASCII
value of the char at that location, replacing the 0 with a 1 will give
you the color at that location (both the background and foreground with
a little manipulation.)
Regards,
'Program for reading a portion of the screen into an array of strings.
DEFINT A-Z
CLS
FOR m = 0 TO 10 'print 11 test lines
start = ASC("A") + m
FOR n = 0 TO 79
PRINT CHR$(start + n);
NEXT n
NEXT m
DIM s(1 TO 5) AS STRING * 80
LOCATE 3, 1 'starting point for copying screen lines
FOR m = 1 TO 5
tmp$ = ""
FOR n = 1 TO 80 'assuming you want all chars on the line
ascii = SCREEN(m + 2, n, 0)
tmp$ = tmp$ + CHR$(ascii)
NEXT n
s(m) = tmp$ 'put in string array
NEXT m
LOCATE 14, 1
PRINT "These 5 lines were copied from the screen beginning at line 3:"
PRINT
FOR m = 1 TO 5
PRINT s(m)
NEXT m
END