[comp.lang.pascal] Code wanted: DOS ^P simulator

peters@yang.earlham.edu (12/14/90)

     Can anyone out there write a procedure that simulates the action of
a ^P (ctrl-P) when pressed at a DOS prompt?  It should turn on 'print mode'
so that all writes to the screen are simultaneously echoed to the printer.
Another ^P should toggls print mode off again.

     All the obvious methods fail.  This one has stumped some very sharp
Turbo Pascal and DOS gurus.  Any help would be appreciated.

     Thanks in advance.

Peter Suber.  Depts. of Philosophy, Computer Science.  Earlham College.
Richmond, Indiana  47374.  317-983-1214.  peters@earlham.bitnet.

peter@cs.umu.se (Peter Lundberg) (12/14/90)

In article <5994@yang.earlham.edu> peters@yang.earlham.edu writes:
>
>     Can anyone out there write a procedure that simulates the action of
>a ^P (ctrl-P) when pressed at a DOS prompt?  It should turn on 'print mode'
>so that all writes to the screen are simultaneously echoed to the printer.
>Another ^P should toggls print mode off again.
>
Well, the keyword here is DOS, if each and every one of the programs that 
were to be used with this utility would use DOS in text mode for doing screen output,
this would not be hard to do. But they don't and won't. That's why there is no
way to trace screen output, like for example on a VT100 terminal.

So don't waste your time, it it was possible the PC would have such a key on the
keyboard, (as terminals often have)

rgds.
Peter Lundberg.

simpson@aplcen.apl.jhu.edu (Simpson David) (12/21/90)

>In article <5994@yang.earlham.edu> peters@yang.earlham.edu writes:
>>
>>     Can anyone out there write a procedure that simulates the action of
>>a ^P (ctrl-P) when pressed at a DOS prompt?  It should turn on 'print mode'
>>so that all writes to the screen are simultaneously echoed to the printer.
>>Another ^P should toggls print mode off again.
>>

Ctrl-Print Screen  (^Print Screen) does this.

              David Simpson

abcscnuk@Twg-S5.uucp (Naoto Kimura (ACM)) (12/23/90)

In article <1990Dec21.020843.6273@aplcen.apl.jhu.edu> simpson@aplcen (Simpson David) writes:
]>In article <5994@yang.earlham.edu> peters@yang.earlham.edu writes:
]>>
]>>     Can anyone out there write a procedure that simulates the action of
]>>a ^P (ctrl-P) when pressed at a DOS prompt?  It should turn on 'print mode'
]>>so that all writes to the screen are simultaneously echoed to the printer.
]>>Another ^P should toggls print mode off again.
]>>
]
]Ctrl-Print Screen  (^Print Screen) does this.
]
]              David Simpson

This only works as long as you *DON'T* use the crt unit, either
directly or indirectly (through another unit).  This is because Crt
grabs control of the standard input and output files which Dos and the
BIOS uses to handle the printer echo.  One way to give control of input
and output back to Dos is to reassign the file variables to the Dos
file handles by using the following:

	...
	Assign(Input,'');
	Reset(Input);
	Assign(Output,'');
	ReWrite(Output);
	...

Not only does this allow printer echoing but it also allows input and
output redirection.  The bad part of this since Crt now has lost control
of the input and output file variables, it won't handle windowing or
scrolling, so your screen gets all messed up.

Of course, there's yet another approach: Try looking at my Logger unit.
You can find it on either simtel-20 or uwasa.fi in a file called
NKTOOLS.ZIP.  Since the source code is available, you can adjust its
behavior to suit your needs.  The one thing you have to make sure is
that the Logger unit appears as the last unit in the USES clause.

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