Results 1 to 3 of 3
Hi all,
is it possible to read directly the content of Clipboard without to be obliged to
paste its content somewhere?
I only need it's text content, which can be ...
- 02-08-2009 #1Just Joined!
- Join Date
- Oct 2004
- Posts
- 62
clipboard reading
Hi all,
is it possible to read directly the content of Clipboard without to be obliged to
paste its content somewhere?
I only need it's text content, which can be read easily from memory (if you
know the starting address).
If the Clipboard is saved in a temporary file it is even easier...
Bye.
- 02-09-2009 #2Linux Newbie
- Join Date
- Jul 2008
- Posts
- 181
Yes, it's possible. In java, you could do the following, for example:
The example assumes you have text in your clipboard, but that is not required.Code:Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); String contents = (String) clipboard.getContents(null).getTransferData(DataFlavor.stringFlavor);
- 02-09-2009 #3Just Joined!
- Join Date
- Oct 2004
- Posts
- 62
Hi burschik,
thank you for replying... but i 'll never use Java or C++ (I hate OOP).
Luckily in the meantime I found a solution using
I loaded it from Synaptic (I have Debian).xclip
For those interested i give some examples:
More interesting.... application to Google Translate:Writing and reading clipboard:
cat TxtFile | xclip -i | xclip -o > FileOut
(which is almost the same as cat TxtFike > FileOut, but demonstrate
that you can read & write the Clipboard)
Wanting for example translate from Italian to english some chemical compounds, you obtain:filtering clipboard with bash
translate a word or a phrase w/ Google Translate + CtrlA (Select All) + CtrlC (Copy)
then... from the shell --> xclip -o | head -n 12 | tail -n 2
Bye.acetilcolina --> acetylcholine
cloruro di litio --> lithium chloride


Reply With Quote