Page 1 of 1

Useful software gone?

Posted: 29 Dec 2011 18:39
by phillid
Hello, all. I posted http://www.dostips.com/forum/viewtopic.php?f=3&t=1119&p=3868 and also http://www.dostips.com/forum/viewtopic.php?f=3&t=1032

I got pointed to lingubender.com, which was fine at the time, but now it's not there, I just get an 'Account Suspended' message. Does anyone have the source code for 'coltext.exe'?

Thanks for any help


--Phillid


(EDIT: Spelling mistake in 'which')

Re: Useful software gone?

Posted: 30 Dec 2011 07:45
by aGerman
I can't find the source code of the tool though but I remember it was compiled with only a few lines of dirty C++.
However, if you would tell me the syntax of the old tool I could write it new within some minutes.

Regards
aGerman

Re: Useful software gone?

Posted: 30 Dec 2011 07:59
by taripo
you really should put coltext.exe in the subject title.

Re: Useful software gone?

Posted: 30 Dec 2011 15:34
by phillid
aGerman: I'm not actually going to use it for batch scripting, I was interested to see which lines of code did the colouring, because I'm writing a C program for DOS that uses colour etc, although I've got a feeling coltext.exe used windows.h, so it wouldn't be suitable for DOS?

Anyway, here's the syntax from what I remember:

Code: Select all

coltext [background][foreground]<.> "Hello, world!"


Where background and foreground are values from 0 to F. the '.' was optional. If included, it place a new line character at the end of the line of text. "Hello, world!" is obviusly just the text to display in the colour ;)

Re: Useful software gone?

Posted: 30 Dec 2011 17:15
by aGerman
phillid wrote:aGerman: I'm not actually going to use it for batch scripting, I was interested to see which lines of code did the colouring, because I'm writing a C program for DOS that uses colour etc, although I've got a feeling coltext.exe used windows.h, so it wouldn't be suitable for DOS?


OK, in this case I only can confirm your fears. I used the SetConsoleTextAttribute function. It's a WINAPI and not applicable for DOS. I'm afraid I can't help.

Regards
aGerman

Re: Useful software gone?

Posted: 01 Jan 2012 04:16
by Cat
You could try using this instead:

Code: Select all

call :coltext 74 "hello" & call :coltext 47 "world" /n
::...
:coltext
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do set "DEL=%%a"
echo off
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1
if "%3"=="/N" echo\
if "%3"=="/n" echo\
exit /b

However, this is painfully slow.

Re: Useful software gone?

Posted: 02 Jan 2012 00:06
by phillid
@Cat: Cheers for that, but as I said I'm not actually using batch, I'm writing a program written in C for DOS. I was going to use a function out of coltext.exe's code in my own code. :)
@aGerman: I thought that would be the case. I ended up finding a compiler-specific funciton, but the only flaw to this is that I wouldn't bother with open source, because I'd get noobs contacting me who are using a different comiler and saying that it's not compiling.

Oh well, thanks for that anyway :)

--Phillid