|
Answer» So, this is really a question of "do you know a resource." I want to learn a little more for graphical formatting in DOS. I know "color" and that's it. LOL! I'd like to know how it is that your can various colors on-screen at the same time, using various ASCII design chars and all that other fun stuff.
Also, I have seen it where there's an actual text field. How does that work. I'd like to put a little something together possibly, but this is SOOO antiquated I couldn't find anything that helped with Google alone... so yeah.So the only graphical things that are built into batch are color, echo off, echo., and 0>nul set /p=.
color changes all text and background. there are a couple of work arounds to c change colors involving findstr that i will post tomarrow when i have access to my notes.
echo off stops the displaying of the command before it is executed.
echo. makes a blank line.
0>nul set /p= will WRITE without ending the line. eg: cout >> "hello world" vs. cout >>"hello world \n"
(if my c++ hasn't failed me yet.)Here is a routine by carlos on dostips.com
Code: [Select]@Echo Off Call :Color A "######" \n E "" C " 21 " E "!" \n B "######" \n Pause >Nul Exit /B
:Color :: v21 :: Arguments: hexColor text [\n] ... :: \n -> newline ... -> repeat :: Supported in windows XP, 7, 8. :: In XP extended ascii characters are printed as dots. :: For print quotes, use empty text. SetLocal EnableExtensions EnableDelayedExpansion Subst `: "!Temp!" >Nul &`: &Cd \ SetLocal DisableDelayedExpansion If Not Exist `.7 ( Echo(|(Pause >Nul &Findstr "^" >`) Set /P "=." >>` <Nul For /F "delims=;" %%# In ( '"Prompt $H;&For %%_ In (_) Do Rem"') Do ( Set /P "=%%#%%#%%#" <Nul >`.3 Set /P "=%%#%%#%%#%%#%%#" <Nul >`.5 Set /P "=%%#%%#%%#%%#%%#%%#%%#" <Nul >`.7)) :__Color Set "Text=%~2" If Not Defined Text (Set Text=^") SetLocal EnableDelayedExpansion Set /P "LF=" <` &Set "LF=!LF:~0,1!" For %%# in ("!LF!") Do For %%_ In ( \ / :) Do Set "Text=!Text:%%_=%%~#%%_%%~#!" For /F delims^=^ EOL^= %%# in ("!Text!") Do ( If #==#! EndLocal If \==%%# (Findstr /A:%~1 . \` Nul Type `.3) Else If /==%%# (Findstr /A:%~1 . /.\` Nul Type `.5) Else (Echo %%#\..\`>`.dat Findstr /F:`.dat /A:%~1 . Type `.7)) If "\n"=="%~3" (Shift Echo() Shift Shift If ""=="%~1" Goto :Eof Goto :__Color @echo off color 07 mode 80, 58 setlocal disableDelayedExpansion set q=^" echo( call :c 04 " "&call :c 40 " " /n call :c 04 " "&call :c 40 " #"&call :c 40 " "&call :c 40 "# " /n call :c 04 " "&call :c 40 " # # " /n call :c 04 " "&call :c 40 "### # # ###" /n call :c 04 " "&call :c 40 "## # # ##" /n call :c 04 " "&call :c 40 "## ##################### ##" /n call :c 04 " "&call :c 40 "## # # # # ##" /n call :c 04 " "&call :c 40 "# # # # # #" /n call :c 04 " "&call :c 40 "# # "&call :c 60 "###"&call :c 40 "# #"&call :c 60 "###"&call :c 40 " # #" /n call :c 04 " "&call :c 40 "# "&call :c 60 "#### "&call :c 40 "# #"&call :c 60 " ####"&call :c 40 " #" /n call :c 04 " "&call :c 40 "# "&call :c 60 "#### "&call :c 40 "###################"&call :c 60 " ####"&call :c 40 " #" /n call :c 04 " "&call :c 40 "# #"&call :c 60 "# #"&call :c 40 " ########### "&call :c 60 "# #"&call :c 40 "# #" /n call :c 04 " "&call :c 40 "# #"&call :c 60 " # #"&call :c 40 " # # "&call :c 60 "# # "&call :c 40 "# #" /n call :c 04 " "&call :c 40 "# #"&call :c 60 " # #"&call :c 40 " # # "&call :c 60 "# # "&call :c 40 "# #" /n call :c 04 " "&call :c 40 "# #"&call :c 60 " # #"&call :c 40 " # # "&call :c 60 "# # "&call :c 40 "# #" /n call :c 04 " "&call :c 40 "# #"&call :c 60 " # #"&call :c 40 " # # "&call :c 60 "# # "&call :c 40 "# #" /n call :c 04 " "&call :c 40 "## #"&call :c 60 " # #"&call :c 40 " # # "&call :c 60 "# # "&call :c 40 "# ##" /n call :c 04 " "&call :c 40 "# # #"&call :c 60 " # #"&call :c 40 "# #"&call :c 60 "# # "&call :c 40 "# # #" /n call :c 04 " "&call :c 40 "# # #"&call :c 60 " # #"&call :c 40 "# #"&call :c 60 "# # "&call :c 40 "# # #" /n call :c 04 " "&call :c 40 "# # #"&call :c 60 " # #"&call :c 40 "## ##"&call :c 60 "# # "&call :c 40 "# # #" /n call :c 04 " "&call :c 40 "# # #"&call :c 60 " # "&call :c 40 "#######"&call :c 60 " # "&call :c 40 "# # #" /n call :c 04 " "&call :c 40 "# # #"&call :c 60 " # # "&call :c 40 "# # #" /n call :c 04 " "&call :c 40 "# # #"&call :c 60 " # # "&call :c 40 "# # #" /n call :c 04 " "&call :c 40 "# # #"&call :c 60 " # # "&call :c 40 "# # #" /n call :c 04 " "&call :c 40 "# # #"&call :c 60 " "&call :c 6f "##"&call :c 60 " "&call :c 6f "##"&call :c 60 " "&call :c 40 "# # #" /n call :c 04 " "&call :c 40 "# # #"&call :c 60 " "&call :c 6f "#"&call :c fb "##"&call :c 6f "###"&call :c 60 " "&call :c 6f "###"&call :c fb "##"&call :c 6f "#"&call :c 60 " "&call :c 40 "# # #" /n call :c 04 " "&call :c 40 "# # #"&call :c 60 " "&call :c 6f "#"&call :c fb "# ###"&call :c 6f "#####"&call :c 60 " "&call :c 6f "#####"&call :c fb "### #"&call :c 6f "#"&call :c 60 " "&call :c 40 "# # #" /n call :c 04 " "&call :c 40 "###"&call :c 60 " "&call :c 6f "#"&call :c fb "# #####"&call :c 6f "#####"&call :c 60 " "&call :c 6f "#####"&call :c fb "##### #"&call :c 6f "#"&call :c 60 " "&call :c 40 "###" /n call :c 04 " "&call :c 40 "#"&call :c 60 " #"&call :c 6f "#"&call :c fb "# #####"&call :c 6f "#"&call :c 60 " "&call :c 6f "#"&call :c fb "##### #"&call :c 6f "#"&call :c 60 "# "&call :c 40 "#" /n call :c 04 " "&call :c 40 "#"&call :c 60 " #"&call :c 6f "#"&call :c fb "# #"&call :c 60 "#######"&call :c fb "# #"&call :c 6f "#"&call :c 60 "# "&call :c 40 "#" /n call :c 04 " "&call :c 40 "#"&call :c 60 "# # "&call :c 6f "#"&call :c fb "###### #"&call :c 60 "#######"&call :c fb "# ######"&call :c 6f "#"&call :c 60 " # #"&call :c 40 "#" /n call :c 04 " "&call :c 40 "#"&call :c 60 "# # "&call :c 6f "######"&call :c fb "#########"&call :c 6f "#"&call :c 60 " "&call :c 6f "#"&call :c fb "#########"&call :c 6f "######"&call :c 60 " # #"&call :c 40 "#" /n call :c 04 " "&call :c 40 "# "&call :c 60 "# # "&call :c 6f "#########"&call :c 60 " "&call :c 6f "#########"&call :c 60 " # #"&call :c 40 " #" /n call :c 04 " "&call :c 40 "# #"&call :c 60 "# # # #"&call :c 40 "# #" /n call :c 04 " "&call :c 40 "# #"&call :c 04 " "&call :c 60 "# # # #"&call :c 04 " "&call :c 40 "# #" /n call :c 04 " "&call :c 40 "# #"&call :c 04 " "&call :c 60 "# # # #"&call :c 04 " "&call :c 40 "# #" /n call :c 04 " "&call :c 40 "# # "&call :c 04 " "&call :c 60 "# # # #"&call :c 04 " "&call :c 40 " # #" /n call :c 04 " "&call :c 40 "# # "&call :c 04 " "&call :c 60 "# # # #"&call :c 04 " "&call :c 40 " # #" /n call :c 04 " "&call :c 40 "# # "&call :c 04 " "&call :c 60 "# # # #"&call :c 04 " "&call :c 40 " # #" /n call :c 04 " "&call :c 40 "# # "&call :c 04 " "&call :c 60 "# # # #"&call :c 04 " "&call :c 40 " # #" /n call :c 04 " "&call :c 40 "# # "&call :c 04 " "&call :c 60 "# # # #"&call :c 04 " "&call :c 40 " # #" /n call :c 04 " "&call :c 40 "# # "&call :c 04 " "&call :c 60 "# # # #"&call :c 04 " "&call :c 40 " # #" /n call :c 04 " "&call :c 40 "# # "&call :c 04 " "&call :c 60 "# # # #"&call :c 04 " "&call :c 40 " # #" /n call :c 04 " "&call :c 40 "# # "&call :c 04 " "&call :c 60 "# # # #"&call :c 04 " "&call :c 40 " # #" /n call :c 04 " "&call :c 40 "# # "&call :c 04 " "&call :c 60 "# # # #"&call :c 04 " "&call :c 40 " # #" /n call :c 04 " "&call :c 40 "# # "&call :c 04 " "&call :c 60 "# # # #"&call :c 04 " "&call :c 40 " # #" /n call :c 04 " "&call :c 40 "# # "&call :c 04 " "&call :c 60 "# # # #"&call :c 04 " "&call :c 40 " # #" /n call :c 04 " "&call :c 40 "# # #"&call :c 60 "## # # ##"&call :c 40 "# # #" /n call :c 04 " "&call :c 40 "# # #"&call :c 60 " # "&call :c 04 " "&call :c 60 " # "&call :c 40 "# # #" /n call :c 04 " "&call :c 40 "# # #"&call :c 60 " # ## ## # "&call :c 40 "# # #" /n call :c 04 " "&call :c 40 "# #"&call :c 60 " ## # # ## "&call :c 40 "# #" /n call :c 04 " "&call :c 40 "# #"&call :c 60 " # "&call :c 40 "###"&call :c 60 " # "&call :c 40 "# #" /n call :c 04 " "&call :c 40 "# #"&call :c 60 " "&call :c 40 "###### ######"&call :c 60 " "&call :c 40 "# #" /n call :c 04 " "&call :c 40 "# ## # # ## #" /n call :c 04 " "&call :c 40 "# ############# #" /n call :c 04 " "&call :c 40 "# ## ## #" /n call :c 04 " "&call :c 40 "# # # #" /n call :c 04 " "&call :c 40 "#####################"
ping -n 99 localhost >NUL
:c setlocal enableDelayedExpansion :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:colorPrint Color Str [/n] setlocal set "s=%~2" call :colorPrintVar %1 s %3 exit /b
:colorPrintVar Color StrVar [/n] if not defined DEL call :initColorPrint setlocal enableDelayedExpansion pushd . ': cd \ set "s=!%~2!" :: The single blank line within the following IN() clause is critical - DO NOT REMOVE for %%n in (^"^
^") do ( set "s=!s:\=%%~n\%%~n!" set "s=!s:/=%%~n/%%~n!" set "s=!s::=%%~n:%%~n!" ) for /f delims^=^ eol^= %%s in ("!s!") do ( if "!" equ "" setlocal disableDelayedExpansion if %%s==\ ( findstr /a:%~1 "." "\'" nul ) else if %%s==/ ( findstr /a:%~1 "." "/.\'" nul ) else ( >colorPrint.txt (echo %%s\..\') findstr /a:%~1 /f:colorPrint.txt "." ) ) if /i "%~3"=="/n" echo( popd exit /b
:initColorPrint for /f %%A in ('"prompt $H&for %%B in (1) do rem"') do set "DEL=%%A %%A" "%temp%\'" set /p "=." subst ': "%temp%" >nul exit /b
:cleanupColorPrint 2>nul del "%temp%\'" 2>nul del "%temp%\colorPrint.txt" >nul subst ': /d exit /b
Fro reference: http://en.wikipedia.org/wiki/ANSI.SYS many older DOS programs use ANSII as a foundation for color PRESENTATIONS of text. Quote Once LOADED, ANSI.SYS enabled code sequences that changed the colors of the cursor and characters on the screen, or enabled software programs to move the cursor up or down lines, enabled blinking text, and similar text graphics features. Using this driver, text could be displayed in 16 different colors ("foreground" colors), with 8 optional background colors. It also allowed for the changing of the video mode from standard 80x25 text mode to a number of different graphics modes (for EXAMPLE, 320x200, 640x200, 40-column text mode) depending on which video graphics card was installed.
|