[comp.lang.pascal] How to capture a screen full of text and write to a file in TP?

s.net>@adm.BRL.MIL (03/17/89)

I know I must be missing something real simple, but how do you 
capture a screen full of text (NOT graphics) and write it to a file as
straight ASCII?  There must be some easy and fast way...

  Thanks in advance,

      DJ

abcscnuk@csuna.csun.edu (Naoto Kimura) (03/19/89)

In article <18746@adm.BRL.MIL> s.net>@adm.BRL.MIL writes:
>I know I must be missing something real simple, but how do you 
>capture a screen full of text (NOT graphics) and write it to a file as
>straight ASCII?  There must be some easy and fast way...
>
>  Thanks in advance,
>
>      DJ


Please clarify what you want to do.  I am assuming you are using an
IBM-PC and not the Macintosh.  There are different ways in which you can
take a screenful of text and save it to a file.

If it is something like sending all the output of a program to a file,
you can use the output redirection using the ">" operator (provided that
the program isn't trying to write directly to the screen but is sending
its output through the standard DOS files).

You could also be interested in using the 'logger' unit that I posted
here a while back (assuming you are using version 4.0 or 5.0).  It
allows you to log whatever goes through 'input' and 'output' to a file
or to the printer.

If you're looking for something where the user can press some keys to
save a screen, you might be interested in grabbing the 'snipper' program
that was posted to comp.binaries.ibm.pc.  It is a resident utility that
allows you to interactively mark a section of the screen and save it in
a file.

One way you can read the contents of the screen in your program is
through the BIOS.  You will have to move the screen cursor to each
position you want to read and request the appropriate service to read
the character and screen attribute at that location.  It goes without
saying that you should store the present location of the cursor before
you do this and restore it after you're done.  The only problem with
this technique is that you might find it too slow for what you want.

Another way is to read the display memory directly in your program.
This requires you to know what kind of display and what mode you happen
to be in.  You'd also want to do some stuff to prevent snow on the CGA
display.  You might want to take a look at the source files to the
MicroCalc spreadsheet that were came with the compiler, because there
were some routines that did this.

                //-n-\\			 Naoto Kimura
        _____---=======---_____		 (abcscnuk@csuna.csun.edu)
    ====____\   /.. ..\   /____====
  //         ---\__O__/---         \\	Enterprise... Surrender or we'll
  \_\                             /_/	send back your *&^$% tribbles !!