Color Function 21 22 23c

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

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

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: 3441
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: 3441
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: 476
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

Post Reply