QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: GTC on May 17, 2019, 10:26:15 am

Title: Make the contents of the output window copy-able to the clipboard?
Post by: GTC on May 17, 2019, 10:26:15 am
Would it be possible to make the contents of the output (DOS type) window copy-able to the clipboard?

Maybe add Copy to the menu at top left of the window?
Title: Re: Make the contents of the output window copy-able to the clipboard?
Post by: Petr on May 17, 2019, 10:45:40 am
Do you  thing how copy the text program output window to the clipboard?

Code: QB64: [Select]
  1. 'generate random text
  2. FOR Text = 1 TO 150
  3.     char = 32 + RND * 95
  4.     char$ = char$ + CHR$(char)
  5. output$ = TIME$ + char$
  6. 'way 1 how copy char$ to clipboard:
  7.  
  8. 'now run windows wordpad and press Ctrl + V
  9. 'END
  10.  
  11.  
  12. 'or if you  have text output but none variable, create it:
  13. Height = _HEIGHT
  14.  
  15. FOR y = 1 TO Height
  16.     FOR x = 1 TO Width
  17.         text$ = text$ + CHR$(SCREEN(y, x))
  18. NEXT x, y
  19. _CLIPBOARD$ = text$
  20.  

Or copy the graphical preview of the window to the clipboard?

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(800, 600, 32)
  2. CIRCLE (400, 300), 250
  3.  
  4.  
  5.  
Or just your own graphic output?

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(800, 600, 32)
  2. CIRCLE (400, 300), 250
  3.  
  4.  
  5.  

Title: Re: Make the contents of the output window copy-able to the clipboard?
Post by: GTC on May 17, 2019, 10:52:44 am
Thanks. I guess I was looking for an every time solution to when I run some quick and dirty code to test a something and like the output.

_CLIPBOARD$ is probably the thing, as long as I remember to include it.
Title: Re: Make the contents of the output window copy-able to the clipboard?
Post by: Jack002 on May 22, 2019, 04:46:31 pm
You need to copy from a DOS screen? I assume windows 10?
I do this.
Click the upper left corner
then do edit, mark
drag your mouse over the text
press enter
Now the text is copied to your keyboard buffer
Title: Re: Make the contents of the output window copy-able to the clipboard?
Post by: Pete on May 22, 2019, 04:56:18 pm
Rats! ChezPete beat me to the punch again! Hey, I'm going to start spiking that punch from now on! All great methods, nothing to add but the funny. It's really neat how versatile this language is.

@Jack: Yes, that's old school. We used that method to copy programming text into the QBasic IDE, too. It was slow, though. It did like a simulated typing, instead of just dumping it all in and being done with t. Still, it was better than typing in a screen or so of code.


Pete