SAVING COLORS

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
LEGRAND
Coder
Posts: 49
Joined: Wed Jul 30, 2008 7:57 am

SAVING COLORS

Post by LEGRAND »

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.
BDZ
Coder
Posts: 49
Joined: Sun Nov 20, 2005 5:41 pm
Location: Wisconsin
Contact:

Post 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: http://www.w3schools.com/html/default.asp
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post 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.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
LEGRAND
Coder
Posts: 49
Joined: Wed Jul 30, 2008 7:57 am

Save colors.....

Post by LEGRAND »

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?
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post 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.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
LEGRAND
Coder
Posts: 49
Joined: Wed Jul 30, 2008 7:57 am

colors saved

Post by LEGRAND »

thak you this will help me.
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post 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

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Post Reply