View previous topic :: View next topic |
Author |
Message |
Royle Apprentice
Joined: 21 Jul 2004 Posts: 223
|
Posted: Tue Nov 09, 2004 12:19 am Post subject: How to copy text from a console? |
|
|
I'm wondering if its possible and how to copy text from a console (xterm) and paste it into another program like firefox. Thanks in advance for your help! |
|
Back to top |
|
|
michaelarch Tux's lil' helper
Joined: 08 May 2003 Posts: 87 Location: Huntsville, AL
|
|
Back to top |
|
|
MagnusBerg Guru
Joined: 07 Oct 2003 Posts: 370 Location: Burgsvik, Gotland, Sweden
|
Posted: Tue Nov 09, 2004 4:38 pm Post subject: |
|
|
I use GClipper. I just select the text with the mouse and it's there in GClippers memory to paste out with the middle mousebutton. It can save a lot of clips in it's memory and I have never filled it up.
emerge gclipper |
|
Back to top |
|
|
teknomage1 Veteran
Joined: 05 Aug 2003 Posts: 1239 Location: Los Angeles, CA
|
Posted: Tue Nov 09, 2004 11:36 pm Post subject: |
|
|
I wrote a perl script using the DCOP module from the KDE project that let's you pipe a command's ouput directly into klipper.
Code: | #!/usr/bin/perl -w
use DCOP;
#connect and register with DCOP
$dcop_client = new DCOP;
$dcop_client->attach();
#create a klipper object
$klip_obj = $dcop_client->createObject("klipper", "klipper");
#grab our data
my @clipboard_lines;
while(<>)
{
chomp($line = $_);
push(@clipboard_lines, $line);
}
$lines = join("\n", @clipboard_lines);
#use the klipper object to put our data in the clipboard
$klip_obj->setClipboardContents("$lines");
#unregister with DCOP like a good citizen
$dcop_client->detach(); |
save that in /usr/local/bin as sklip and then call it from the command line like this. Code: | cat ~/bin/sklip |sklip |
|
|
Back to top |
|
|
|