Posts: 210
Threads: 25
Joined: Apr 2022
Reputation:
5
I'm not sure how many lines of code you have to send to the printer but if it's not that many I simply use the LPRINT statement. Using the Find Replace, I first change all Print to LPrint and then all the other lines of code which do not have a Print statement I just insert LPRINT " at the beginning of the line. After printing I put the code back to it's original. The more code you want to print the more tedious this is but it works.
IE Original Code
A = 5
B = 33.3
C = 123
If B > C then exit sub
if C > B then
F = A * B
Print F
End If
Using SEARCH - FIND - REPLACE
Find Print
Replace with LPrint
Using Copy Paste - Insert LPrint " at the beginning of each line.
Code to printer now looks like this
LPrint "A = 5"
LPrint "B = 33.3"
LPrint "C = 123"
LPrint "If B > C then exit sub"
LPrint "if C > B then "
LPrint "F = A * B"
LPrint F
LPrint "End I"
It would be nice if there was a print to printer option in the IDE tools but I understand PRINT is a monster on it's own to deal with. Not sure if this helps you at all.
Posts: 2,700
Threads: 124
Joined: Apr 2022
Reputation:
134
I use to save hardcopies of code back in 90's glad to be out of habit.
Though sometimes you can see things when printed out that you might miss from inside IDE.
But scanning code in IDE is way faster and less wasteful of paper and ink.
b = b + ...
Posts: 2,700
Threads: 124
Joined: Apr 2022
Reputation:
134
11-27-2022, 06:17 PM
(This post was last modified: 11-27-2022, 06:19 PM by bplus.)
Yeah when if I need something printed I used a WP but I have gotten great results with _PrintImage. Just convert what you want printed into images. I've had great success with calendars, accounting forms and shopping lists. OK might be a little work with lines and lines of text, make a little convert app to take a bas file, divide it to pages and print blocks of text to image using _PrintImage? Depends how much stuff you have/want to do.
b = b + ...
Posts: 4
Threads: 1
Joined: Dec 2022
Reputation:
0
Visual Studio Code doesn't print from the IDE either. If the programmer wants to print source code, the process it to download a plugin that exports the source to HTML and then opens a browser on it. From there the programmer can print.
So we could do the same in QB64 IDE: export to HTML and then shell to browser
-- Bruce
Posts: 1,510
Threads: 53
Joined: Jul 2022
Reputation:
47
12-10-2022, 07:47 AM
(This post was last modified: 12-10-2022, 07:53 AM by mnrvovrfc.
Edit Reason: Rambling as usual, it's what I do best
)
Welcome to the forums.
I wish there was another program, which is not a &%$*#@ing web browser that could display HTML documents formatted properly. It's because no web browser loads fast, and tolerable enough to use it offline like the first few versions of Internet Explorer and Firefox.
This way could work for documents greater than 1MB. But source code seldom gets that big, definitely not C++ or Python or any other OOP. I proposed advice that was given away for free for many years in the QB64 Wiki, which doesn't apply to those on Unix-like operating systems that cannot have Wine.
Hmmm... doesn't Visual Studio IDE have an option to run a program EXE file with command-line arguments? Then QB64(PE) could be used to write a program that does the printing, after it's passed an ordinary text file. Just use "LPRINT" and watch out for CHR$(34) put literally in the code.
EDIT: It requires the code to be saved as ordinary text file. Now I don't remember but I read somewhere that things could get as perverse as binary signatures and stuff like that being part of a function header! Don't want to anger somebody about what it looks like his/her favorite tool...