ID:               31516
 User updated by:  csaba at alum dot mit dot edu
 Reported By:      csaba at alum dot mit dot edu
-Status:           Feedback
+Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: Windows
 PHP Version:      5.0.3
 New Comment:

Thanks Derick, this is exactly the kind of thing that I was looking
for.  Unfortunately, as I make it out, there is a problem (and I here
document the steps):

For this to work ANSI.sys must be a driver for the command prompt, but
this will only work under COMMAND.COM.  To do this, as described at
http://www.evergreen.edu/biophysics/technotes/program/ansi_esc.htm
and http://support.microsoft.com/default.aspx?scid=kb;en-us;Q101875
I first edit my \windows\system32\CONFIG.NT file by adding to the three
existing lines:
dos=high, umb
device=%SystemRoot%\system32\himem.sys
files=4

the following two lines:
DEVICEhigh=%systemroot%\system32\ANSI.SYS
dosonly

and save it as CONFIGDS.NT

Now I create a new shortcut in windows and point it to
\windows\system32\COMMAND.COM  In the advanced section under the
Program tab, for Config filename I put:
%SystemRoot%\SYSTEM32\CONFIGDS.NT

For testing, I make a batch file with a one line entry:
echo {ESC}[2J
where that {ESC} is the escape character (hex 1B)
If I run the batch file, the screen is reset to my expectations.

UNFORTUNATELY, when I try to run PHP, I get the following message:
This program cannot be run in DOS mode.

Unless I've missed something in seems like PHP and the ANSI control
codes are mutually exclusive on Win XP and Win 2K.

Csaba


Previous Comments:
------------------------------------------------------------------------

[2005-01-12 16:29:22] [EMAIL PROTECTED]

almost ;-)

<?php
echo chr(27), "[H", chr(27), "[2J";
?>


------------------------------------------------------------------------

[2005-01-12 16:26:58] [EMAIL PROTECTED]

Just send the appropriate escape sequence, afaik this should work:

echo chr(27), "[2H";


------------------------------------------------------------------------

[2005-01-12 14:26:03] csaba at alum dot mit dot edu

Description:
------------
>From a command line php.exe invoked from a cmd prompt under Win XP Pro,
I'd like to be able to blank the screen and/or determine the screen
height.

Motivation:
I have a program that takes several hours to run and it shows several
lines of progress statistics, which are periodically updated.  I'd like
to keep this presentation professional.

I could simulate what I'm asking by interspersing 1000 "\n" whenever
I'm printing an updated set of stats.  However, this puts the info at
the bottom of the screen.  If I could programatically determine the
height (since it might be changed/stretched/shrunk by the user) of the
DOS (CMD) screen in lines then I could compensate for it (and if you
give me that, I'd like to know the width, too, please).  

Alternately, if there was a simple way to blank the screen with the
cursor starting off at the top left, that might be another way to go
(sort of a PHP issued CLS).

Thanks for considering whether this is possible/reasonable,
Csaba Gabor from Vienna

Note:  This is distinct from http://bugs.php.net/bug.php?id=24109
because (1) as I understand it, ncurses does not apply here because it
does not work for DOS/cmd prompts. (2) I want to reuse the current
window.

Apropos:  Perhaps an alternate approach (Ie. feature request) is to ask
PHP to return a handle to its parent process.  Perhaps it is possible to
query that (using Windows APIs) for its properties.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=31516&edit=1

Reply via email to