Color Function 21 22 23c

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
Aacini
Expert
Posts: 1913
Joined: 06 Dec 2011 22:15
Location: México City, México
Contact:

Re: Color Function 21 22 23c

#31 Post by Aacini » 25 Aug 2018 19:22

CirothUngol wrote:
25 Aug 2018 16:25

Off topic, is there also a quick and efficient native solution for locating the cursor at specific location in the console window?
I strongly suspect that the only satisfactory solution will be an external one, but I'm looking at native alternatives anyway. ^_^
Move cursor to *any position* using just ECHO command

jeffshead
Posts: 1
Joined: 17 Nov 2018 10:48

Re: Color Function 21 22 23c

#32 Post by jeffshead » 17 Nov 2018 10:59

@Carlos
I just came across your OUT.EXE. Awesome! Thanks for sharing.

However, I did encounter an issue. I need to pass a variable to OUT.EXE so it is echoed in a particular color. The variable is a path. OUT.EXE strips the "\" slashes.

Example:
Variable is: %pathToFile%

Line of code:

Code: Select all

"%filesFolder%\out.exe" 09 "%pathToFile%\r\n"
The code above outputs the following:
C:UsersjohnDesktopfolder

It should be:
C:\Users\john\Desktop\folder


Is there anyway to work around this?

=======================
UPDATE: I found a solution.
=======================

Change:

Code: Select all

"%filesFolder%\out.exe" 09 "%pathToFile%\r\n"
To:

Code: Select all

"%filesFolder%\out.exe" 09 "%pathToFile:\=\\%\r\n"

fred_gaou
Posts: 3
Joined: 26 Dec 2018 06:45

Re: Color Function 21 22 23c

#33 Post by fred_gaou » 26 Dec 2018 07:39

@Carlos

Hi,

The download link to out.exe is broken.

Currently, I have a version with this md5 checksum:
24ac932a11eab64ead2ddeb16b6eccaa

Can someone confirm this is the last version?

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Color Function 21 22 23c

#34 Post by aGerman » 26 Dec 2018 08:47


fred_gaou
Posts: 3
Joined: 26 Dec 2018 06:45

Re: Color Function 21 22 23c

#35 Post by fred_gaou » 26 Dec 2018 08:54

Here is a tip to display exclamation marks if used

Code: Select all

SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
Test it

Code: Select all

@Echo Off
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
set err=0C
set ok=0A
set n=0F
set out=out.exe
set "test=some path"

echo TO DISPLAY EXCLAMATION MARKS
echo.
echo Use double ^ with echo but only one with out.exe ^^!
echo.
%out% %n% "\ttest normal^!" %err% "\ttest err^!" %ok% "\ttest ok^!\n\n"

%out% %n% "\tDisplay exclamtion marks : " %err% "^!test^!\n"

echo.
pause

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Color Function 21 22 23c

#36 Post by aGerman » 26 Dec 2018 09:43

Yes that's the usual way. It has nothing to do with out.exe but with unquoted and quoted strings.

Code: Select all

@echo off &setlocal EnableDelayedExpansion
echo ^^!
echo "^!"
pause
Steffen

carlos
Expert
Posts: 503
Joined: 20 Aug 2010 13:57
Location: Chile
Contact:

Re: Color Function 21 22 23c

#37 Post by carlos » 26 Dec 2018 19:34

Hello.

@jeffshead: sorry for the late reply, your solution was right, because the \ character is used as the escape sequence character.

@fred_gaou, I cannot remember what was the last version of out.exe, but I deprecated it because you can achieve the same functionality using my bg program v3.9se using this syntax:

Code: Select all

bg print A "Hello " C "\01"
You also can print the exclamation character using the escape sequence \21
Image

Documentation (only for the print function of bg):
BG Print color text ...
::print text in HEXADECIMAL color without new line to end. You can repeat arguments.
::the text recognize the next oem escape sequences:
\r print a carriage return
\n print a newline
\\ print \
\Number HEXADECIMAL ascii number code from 00 to FF.
Example: \01 is face character
Example: \41 is A
Note 2: You can repeat arguments.
Example: BG.exe Print A "Text in color A" B "Text in color B"
You can download it from internet wayback archive :
https://web.archive.org/web/20180926041 ... .com/p/bg/

I hope you can use bg.exe instead of old out.exe

fred_gaou
Posts: 3
Joined: 26 Dec 2018 06:45

Re: Color Function 21 22 23c

#38 Post by fred_gaou » 26 Dec 2018 22:07

@Carlos

I saw the bg tool. I liked to work with out but I will give bg a try and test its other functions. Thanks

SharaStar
Posts: 2
Joined: 23 Oct 2020 14:17

Re: Color Function 21 22 23c

#39 Post by SharaStar » 23 Oct 2020 15:14

"█"

How to use this symbol for the color functions?
cmd /u
color 0b
@echo █

It doesnt display... Help?

And are there any simple beginners game tutorial in colour like the
https://www.youtube.com/watch?v=sJy1sgvKDhU on youtube?

I would like to try out.

(Im new here, Shara... I hope outside links as refference are okay. TQ)

T3RRY
Posts: 250
Joined: 06 May 2020 10:14

Re: Color Function 21 22 23c

#40 Post by T3RRY » 24 Oct 2020 07:30

SharaStar wrote:
23 Oct 2020 15:14
"█"

How to use this symbol for the color functions?
cmd /u
color 0b
@echo █

It doesnt display... Help?

And are there any simple beginners game tutorial in colour like the
https://www.youtube.com/watch?v=sJy1sgvKDhU on youtube?

I would like to try out.

(Im new here, Shara... I hope outside links as refference are okay. TQ)
nonstandard characters require use of the appropriate codepage to display. which can be changed via the code page command:

Code: Select all

CHCP n
where n is the number of the required codepage. 65001 is the general option used for unicode characters.

Depending on what if any external exe's you intend to use, they may or may not support printing of non standard characters - you'll have to track down their readme's or view their helpfile.

Getting a bit off topic ...

Not that I haven't wasted by own fair share of time coding useless batch games, Why not start with something like ruby - https://try.ruby-lang.org/
Or if coding games is omething you would like to get into seriously, Unity? Plenty of tutorials out there.

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Color Function 21 22 23c

#41 Post by aGerman » 24 Oct 2020 08:12

T3RRY wrote:
24 Oct 2020 07:30
nonstandard characters require use of the appropriate codepage to display. which can be changed via the code page command:

Code: Select all

CHCP n
where n is the number of the required codepage. 65001 is the general option used for unicode characters.
Actually it's a missmatch between the console codepage and the codepage the script was saved. If you change the codepage of the console to UTF-8 you have to make sure the script is saved in UTF-8 (without BOM), too.
T3RRY wrote:
24 Oct 2020 07:30
Getting a bit off topic ...

Not that I haven't wasted by own fair share of time coding useless batch games, Why not start with something like ruby - https://try.ruby-lang.org/
Or if coding games is omething you would like to get into seriously, Unity? Plenty of tutorials out there.
It's rather the nature of a console window which limits it for displaying graphics. Consoles are textual interfaces. They are divided into character cells like a quad ruled paper. Each of these character cells can hold exactly one character with a specified foreground and background color, and you can't partition a character cell any further. So, using a console for graphics is rather a missuse. The only possibility to get proper graphics into a console is the way misol101 is doing it. But he just doesn't care about the quad ruled paper at all. He treats it as a canvas, takes a brush and covers everything with a layer of oil paint. (Figuratively speaking.) Nothing you could even do using any regular console application.

Steffen

Post Reply