LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   append selected text to a txt, in order to gather notes (https://www.linuxquestions.org/questions/linux-newbie-8/append-selected-text-to-a-txt-in-order-to-gather-notes-4175422352/)

unixor 08-16-2012 02:45 AM

append selected text to a txt, in order to gather notes
 
hello!

I would like with one keyboard shortcut or mouse shortcut to append the text I have selected to a txt/doc file, after a newline inserted

is it possible?

thanks!

dahweeds 08-16-2012 08:13 AM

Well. I am running right now Linux Mint 13 MATE version. So I opened a text file next to the browser. Then I left click at the start of your post, drag the mouse to the end (from "hello! ... to ... thanks!" and then release the mouse leaving the text highlighted. Then I roll the mouse over the highlighted text until the cursor changed, then left click and drag to my text file. The text seems to float accross the screen and when I release the button on my text file, it is pasted in.

It is a detailed description, but it is a two step process I think so it might not be what you need.

1) selected text with mouse
2) drag and drop the selection into the txt file

This is firefox 14.01.

I tried the same between two text files and it works as well.

Next to this computer I have the Fedora 17 KDE. This process works here too if I select from browser, drag to email and drop, then select in email and drag to text file and drop.

EDIT:
I just find that when I select the text, then mouse over the txt file and press the wheel (center mouse button) the text is also pasted right in. So if you have a center wheel on your mouse you can select and then click. It might still be two steps though.

David the H. 08-16-2012 08:41 AM

Install the xsel application (xclip will work too), to allow you scripting access the visual selection. Then just set up a hotkey (using the binding feature your desktop offers, or xbindkeys) to run a simple script like this:

Code:

#!/bin/bash

echo >> "$1"
xsel >> "$1"

exit 0


The first and only argument for the script will be the name of the file you want to use, so the command for your hotkey will be:

Code:

/path/to/scriptname /path/to/filename


All times are GMT -5. The time now is 08:45 PM.