How to get XP ANSI to redefine keys and color prompt?

B

Bill Scott

Please confirm: Articles on Web convey XP ANSI cannot redefine keys and
prompts will require extensive editing.
In my case, in XP Professional command prompt, SET shows command.com loaded.
MEM shows ansi.sys loaded.
BAT file to redefine functions keys does not work (works in win98 dos box).
Example: ESC [0;65;"ex";13p redefines Function key F7 so that at prompt it
types EX enter (which runs doskey macro that types exit enter). (Note: ESC
means character ESC.) Does not work in XP.
Award winning prompts from PC Computing and other magazines do not work.
(instead of just $P$G, winners include Xmas tree, birthday cake, etc).
Halloween example:
PROMPT ESC [1;32;40m Ú$_$e[33;43m $e[40m$_$e[43m ESC $_ ßß $e[5;40;37m
BOO !ESC[0;40;1;35m $P$G ESC[1;32mESC[K ESC[1D

Background: Got first PC in 1984. Still do typing in dos programs. In
process of upgrading from Win98se to XP Professional. (XP Prof has expanded
memory, Vista does not have EMS that DOS programs can use.)
TIA! --- Bill
P.S. also in process switching internet provider, email address will
eventually change.
 
M

Mark Blain

Please confirm: Articles on Web convey XP ANSI cannot redefine keys
and prompts will require extensive editing.
In my case, in XP Professional command prompt, SET shows command.com
loaded. MEM shows ansi.sys loaded.
BAT file to redefine functions keys does not work (works in win98 dos
box). Example: ESC [0;65;"ex";13p redefines Function key F7 so that at
prompt it types EX enter (which runs doskey macro that types exit
enter). (Note: ESC means character ESC.) Does not work in XP.
Award winning prompts from PC Computing and other magazines do not
work. (instead of just $P$G, winners include Xmas tree, birthday
cake, etc). Halloween example:
PROMPT ESC [1;32;40m Ú$_$e[33;43m $e[40m$_$e[43m ESC $_ ßß
$e[5;40;37m BOO !ESC[0;40;1;35m $P$G ESC[1;32mESC[K ESC[1D

Background: Got first PC in 1984. Still do typing in dos programs. In
process of upgrading from Win98se to XP Professional. (XP Prof has
expanded memory, Vista does not have EMS that DOS programs can use.)
TIA! --- Bill
P.S. also in process switching internet provider, email address will
eventually change.

"Take Command" (formerly 4NT) is a thrid-party replacement command
processor that supports ANSI escape sequences, but I'm not sure whether
their free version does. See these links:
http://www.jpsoft.com/help/index.htm?iniwindowdlg.htm
http://jpsoft.com/Comparison.html
 
B

Bill Scott

Mark!
So you're saying XP ANSI can't do it?
Thanks for tip on Take Command. I'm too scared of Windows to try it - have
had bad luck experimenting with new software then trying to uninstall it.
Windows ain't like days of DOS when the program could simply be deleted. And
here I would have to see if Take Command works with TameDOS and TSRs and
programs I normally use. But when my win98 PC breaks and I'm forced to the
New Technology I'll keep TC in mind.
Thanks! --- Bill
 
B

Bill Scott

Mark! Thanks!!!
I will tolerate lots of restrictions if it lets me do what I now do
automatically. Keridbey seems to provide the step-by-step instructions I
need - actually thought I had done all that, but will try again and will do
search on his name to see if he figured out anything else.
Just read Windows 7 beta supports EMS that dos programs can use, but will
not be out until 2010. Things to look forward to, maybe. But for my parents
am looking through old PC shops for fastest Win98 I can find - they really
hate learning new stuff.
--- Bill
 
B

Bill Scott

SUCCESS !!! - with redefining keys.

To redefine keys, the trick is to use ECHO.
Example: to redefine F1 to clear the command line and screen

echo ^[0;59;"^cls";13p

Note ^ stands for ESC key.
The second ^ clears command line, then cls clears screen. 13p is enter.

Manual may say to use ECHO. but has not been necessary since at least DOS
3.3. I've used the same BAT file since then and had no problem until XP.

So, to load and use ansi, my config.nt is as follows (which is cut and
paste from bunch of articles, I don't know logic involved):

dosonly
device=%SystemRoot%\system32\ansi.sys
shell=c:\windows\system32\command.com

My autoexec.nt ends with path and name of BAT that loads redefinitions and
stuff.

Prompt problem remains. The award winning prompts run out of environment, as
if XP lowered the number of characters allowed on a command line. I do not
know if there is a way to change this.

keridbey's article was helpful on making sure ANSI was loaded and stuff.
Thanks again!
--- Bill
 
M

Mark Blain

Prompt problem remains. The award winning prompts run out of
environment, as if XP lowered the number of characters allowed on a
command line. I do not know if there is a way to change this.

Type "command.com /?" for a look at the available parms.
Adjust the environment with /E.
 
B

Bill Scott

Mark!
Almost. Seems to take second command. That is:
Config.nt loads command. Adding /e:2048 or more does no good.
Editing properties for more environment does no good.
Doing command/e:1024 at prompt works, but loads second command.com, takes
about 5k of memory, must enter exit for each instance of command.
If second command loaded, then load prompt, then exit command, prompt
disappears, must re-enter prompt=$P$G.

So can load second command to display fancy prompt for special moment, then
exit second command, get back 5k memory, and redo prompt. Not ideal, but...
Thanks again!
 
M

Mark Blain

Mark!
Almost. Seems to take second command. That is:
Config.nt loads command. Adding /e:2048 or more does no good.
Editing properties for more environment does no good.
Doing command/e:1024 at prompt works, but loads second command.com,
takes about 5k of memory, must enter exit for each instance of
command. If second command loaded, then load prompt, then exit
command, prompt disappears, must re-enter prompt=$P$G.

So can load second command to display fancy prompt for special moment,
then exit second command, get back 5k memory, and redo prompt. Not
ideal, but... Thanks again

Ok, try this: find command.com (probably in c:\windows\system32\), right-
click it, choose Properties and set the environmment in the Memory
settings. See if that change "sticks". Another, perhaps safer way would
be to create a desktop shortcut to command.com (right-click and drag
command.com, then drop it on your desktop and choose "create shortcut") and
set the environment in the properties for the shortcut. You can edit that
shortcut to run whatever startup batch file you wish, which kills two birds
with one stone.
 
B

Bill Scott

Mark! SUCCESS !!!
In Properties > program > Cmd Line put in switch, like so:
c:\windows\system32\command.com /e:1024 (seems enough env so far)

I had memory > environment at 2048, thought in replaced /e, but no...

Also had in config.nt shell=c:\windows\system32\command.com /e:2048, to no
effect. Am leaving shell=c:\windows\system32\command.com, though not sure if
necessary given shortcut Cmd Line. Don't know if it takes memory. It does not
seem to load a second command.com.

Below should be Flag. Replace ^ with Esc character. How to put in Esc varies
from program to program. (I forget where prompt from, maybe AOL)
PROMPT= ^[41;1;37mºº^[0;44;1;37m°°^[0m$_^[41;1;37mºººº^[0;1;37m $p$g

Note on redefining keys. Ansi macros can take memory if too large. I limit
them to two letters Enter, which may run doskey macros (actually CED because
doskey takes over function keys) which may run subroutines in a BAT file,
which may run a SmartKey macro that puts command on line without entering it.

Thanks again!!!
--- Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top