Page 1 of 1


Posted: Tue Jan 19, 2010 11:53 am
This time, I use instruction COLOR to enhance QBASIC sreen but when saving results in a folder with instruction OPEN " ",#1,"WHATEVER"
I get all lines in BLACK. Could the solution be to save the results directly on WORD but is possible?
Many thanks in advance for help.

Posted: Tue Jan 19, 2010 2:32 pm
by BDZ
COLOR is only for text/graphics displayed on the screen. When you write text to the file, it's just text--bytes of data that are decoded as ASCII characters.
I have no idea how the word file format works, but one possible solution would be to have your program write HTML files. Have it write tags around the text that have attributes that specify the color. Other than that, I can't think of an easy way to save text with colors. Check this link for some info on how HTML works:

Posted: Wed Jan 20, 2010 2:12 am
by burger2227
You cannot print a color to ANY file period! Whatever you print to the screen is irrelevant.

You want fancy fonts, save the file as RTF or DOC and change it there.

Save colors.....

Posted: Wed Jan 20, 2010 10:00 am
This question was in my mind for a long time. Identical issue is to print directly from basic to printer. I know it works when changing several commands but I never tried....and the third one is to stop screens page after page, to have time to read first results.Only possIbility I see is to use view print.Right?

Posted: Wed Jan 20, 2010 6:05 pm
by burger2227
The best way to print a file and save paper and ink is to just copy it to a file first. Then open the file in a text editor to view the results before deciding to print it. A good idea when testing programs.

You can use SHELL to open the file in Notepad or another text editor.

SHELL "START Notepad " + filename$

You can print it from Notepad if you like the text. If not, delete it! The QB program will be mininized to the taskbar however and fullscreen programs will need to change SCREEN MODES before creating a new screen to view.

If program was in fullscreen 0: SCREEN 12: SCREEN 0
If program was in any other mode: SCREEN 0: SCREEN originalmode

Notepad needs no program path, while other programs may.

colors saved

Posted: Thu Jan 21, 2010 1:22 pm
thak you this will help me.

Posted: Thu Jan 21, 2010 2:53 pm
by burger2227
Your welcome!

To directly Print a file using Notepad use the /P option

SHELL "CMD /C START /min Notepad /P " + filename$

In NT, XP or 2000