How to select and copy the contents of the console

General FreeBASIC programming questions.
Post Reply
Tolo68
Posts: 105
Joined: Mar 30, 2020 18:18
Location: Spain

How to select and copy the contents of the console

Post by Tolo68 »

Hello everyone.

You can copy the contents of the console to the clipboard, and then paste it into a txt file???

Thank you
Lothar Schirm
Posts: 490
Joined: Sep 28, 2013 15:08
Location: Germany

Re: How to select and copy the contents of the console

Post by Lothar Schirm »

Yes, you can. Click on the console menu (upper left corner in the title bar of the console) and select "Edit" -> "Mark". Mark your selected text and select "Edit" -> "Copy". Then you have your selected text in the clipboard and can paste it into an editor. I hope I have used the right expressions, because I have a windows console in german language. The steps in german are "Bearbeiten" -> "Markieren" and "Bearbeiten" -> "Kopieren".
srvaldez
Posts: 3603
Joined: Sep 25, 2005 21:54

Re: How to select and copy the contents of the console

Post by srvaldez »

I usually just left-click & drag to select the text I want then to copy to clipboard simply right-click on the console window
subsequent right-click on the console window will paste the clipboard content to the console
Tolo68
Posts: 105
Joined: Mar 30, 2020 18:18
Location: Spain

Re: How to select and copy the contents of the console

Post by Tolo68 »

Lothar Schirm wrote: Jul 13, 2023 9:59 Yes, you can. Click on the console menu (upper left corner in the title bar of the console) and select "Edit" -> "Mark". Mark your selected text and select "Edit" -> "Copy". Then you have your selected text in the clipboard and can paste it into an editor. I hope I have used the right expressions, because I have a windows console in german language. The steps in german are "Bearbeiten" -> "Markieren" and "Bearbeiten" -> "Kopieren".
But in the FreeBasic console I do not get any menu, that is, if I do a....

Print "hello"
Sleep

This prints it on a black screen, and it has no menus. Unless you refer to the other one that opens with...

Open Console

but I don't know how to send data to it.

Thank you
Tolo68
Posts: 105
Joined: Mar 30, 2020 18:18
Location: Spain

Re: How to select and copy the contents of the console

Post by Tolo68 »

Thank you, I was able to enter the menu, pressing the icon of the system symbol.

Surely many years ago I had done it, but I did not remember. I was also able to change the source and buffer size, as I couldn't see the data at the beginning.
Lothar Schirm
Posts: 490
Joined: Sep 28, 2013 15:08
Location: Germany

Re: How to select and copy the contents of the console

Post by Lothar Schirm »

Tolo68 wrote: Jul 13, 2023 14:13 Thank you, I was able to enter the menu, pressing the icon of the system symbol.
Yes, I am sorry I was not so clear in my explanation.
deltarho[1859]
Posts: 4690
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: How to select and copy the contents of the console

Post by deltarho[1859] »

If you want to copy the whole console output to the clipboard then execute

Code: Select all

Control + A 
followed by

Code: Select all

Control + C
Job done.

If you wish to copy selected text, then right-click on the Console's title bar and select 'Edit > Mark'.

Now select text with the mouse.

Then execute

Code: Select all

Control + C
Job done.
Munair
Posts: 1289
Joined: Oct 19, 2017 15:00
Location: Netherlands
Contact:

Re: How to select and copy the contents of the console

Post by Munair »

On Linux consoles Ctrl+A/C/V do not work. Instead, they support the old (DOS) keys Ctrl+Ins (copy) and Shift+Ins (paste) whereby Ins is the Insert key.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: How to select and copy the contents of the console

Post by TJF »

You can redirect the console output in a shell. By default the output is send to STDOUT. Ie

Code: Select all

echo Hallo
prints to the console (terminal), but
  • executing

    Code: Select all

    echo Hallo > outfile.txt
    sends the output to a new file named outfile.txt in the current folder, and
  • executing

    Code: Select all

    echo Hallo >> outfile.txt
    appends the output to an existing file named outfile.txt in the current folder (creating a new one if non-existent).
Regards
Lothar Schirm
Posts: 490
Joined: Sep 28, 2013 15:08
Location: Germany

Re: How to select and copy the contents of the console

Post by Lothar Schirm »

If you want to copy text from the console using FreeBASIC, you can use the Screen-Function (https://www.freebasic.net/wiki/KeyPgScreenCons) to store the text from the console either line by line into an array of strings or to store the text into a single string (using line feed). You can then store the text into a text file.
Post Reply