Print source code from the IDE - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11) +--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2) +--- Thread: Print source code from the IDE (/showthread.php?tid=1191) |
Print source code from the IDE - Kernelpanic - 11-26-2022 I haven't printed anything since the beginning of the year, didn't have to since everything was done via email, but now I wanted to print some source code, but how? See the screenshot. How should I print this source code? I could copy it to Notepad++. . . If I didn't miss anything, then that is a serious mistake. bild server RE: Print source code from the IDE - mnrvovrfc - 11-26-2022 FROM: https://qb64phoenix.com/qb64wiki/index.php/SHELL (Example #2): Code: (Select All) INPUT "Enter a file name to read in Notepad: ", filename$ Maybe you would like to fix it up so it always looks for a file inside QB64 folder or wherever else you save your source code. RE: Print source code from the IDE - Dimster - 11-27-2022 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. RE: Print source code from the IDE - bplus - 11-27-2022 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. RE: Print source code from the IDE - Kernelpanic - 11-27-2022 Thanks for the tips. Looks everything tremendous. I print out source code if it's interesting because I then make notes about it. And I also print out various instructions. Under Vista Ultimate I once ruined the system with a partitioning tool. That was bad because my private data was encrypted. It took me 13 hours to salvage the system and I couldn't have done it without guidance. Well, copying and pasting the text into Notepad++ is probably more practical. Maybe someday there will be a print function in the IDE. They must have forgotten that, because there was a print function in QuickBasic 4.x. RE: Print source code from the IDE - bplus - 11-27-2022 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. RE: Print source code from the IDE - mnrvovrfc - 11-27-2022 (11-27-2022, 04:48 PM)Kernelpanic Wrote: Well, copying and pasting the text into Notepad++ is probably more practical. Maybe someday there will be a print function in the IDE. They must have forgotten that, because there was a print function in QuickBasic 4.x.Not as much that it was forgotten. Life was a lot simpler while QuickBASIC was king -- a lot, as far as printers were concerned. There was no such thing as USB. It was before manufacturers made things more difficult than they needed to be and people demanded out of line-printer and dot-matrix territory into laser-printer high quality. If we still had to deal in the majority with dot-matrix printers then QB64(PE) would have had a print function in its IDE a long time ago. Galleon and his supporters were still cool enough to come up with a graphics printing job that could be appreciated. Dimster made a point which could be developed further into a program that reads source code and just uses "LPRINT" to print each line, careful to decorate the pesky CHR$(34). RE: Print source code from the IDE - bruce_axtens - 12-10-2022 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 RE: Print source code from the IDE - mnrvovrfc - 12-10-2022 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... RE: Print source code from the IDE - bruce_axtens - 12-10-2022 (12-10-2022, 07:47 AM)mnrvovrfc Wrote: Welcome to the forums.Thanks for the welcome. Another option is to pick some other page description language (Markdown, LaTEX, PostScript), shell to a renderer and print from there. I get it that none of these options are as nice as LPRINT. I was thinking more about printing out source than actually allowing QB64PE to open a print job (using say Desktop App Printing) and directing text and metadata to it. Some way-better-than-me Win32 programmer might want to do that some time. -- Bruce |