Req #31516 [Fbk->NoF]: Clear screen or ScreenSize
Edit report at https://bugs.php.net/bug.php?id=31516&edit=1
ID: 31516
Updated by: php-bugs@lists.php.net
Reported by: csaba at alum dot mit dot edu
Summary: Clear screen or ScreenSize
-Status: Feedback
+Status: No Feedback
Type: Feature/Change Request
Package: *General Issues
Operating System: Windows
PHP Version: 5.0.3
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2017-01-20 20:27:20] heiglandreas@php.net
Is this still relevant?
------------------------------------------------------------------------
[2005-01-12 19:20:46] csaba at alum dot mit dot edu
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
------------------------------------------------------------------------
[2005-01-12 16:29:22] derick@php.net
almost ;-)
<?php
echo chr(27), "[H", chr(27), "[2J";
?>
------------------------------------------------------------------------
[2005-01-12 16:26:58] derick@php.net
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 https://bugs.php.net/bug.php?id=31516&edit=1
Thread (6 messages)