Grabbing Screen Content 
Author Message
 Grabbing Screen Content

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!



Thu, 14 Dec 2000 03:00:00 GMT  
 Grabbing Screen Content

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



Thu, 14 Dec 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Grabbing BMP file contents

2. Capturing screen contents of full screen DOS app under windows

3. Capturing screen contents of full screen DOS app under windows

4. Web Browser: Grabbing the contents

5. Screen Print/Grab from within IE

6. Screen grabbing - help me, please

7. Screen grabbing using VB

8. Screen Grabbing in VB.

9. Grab any text on screen on mouseover??

10. GSG?9: grab screen

11. Screen grabbing

12. Grabbing a screen Image to a bitmap

 

 
Powered by phpBB® Forum Software