0

I want to copy highlighted text from a certain site into an output folder on my Desktop. I know there are scripts that can copy highlighted text via JavaScript but I've only seen them for copying highlighted text on the particular website where your JavaScript is being executed.

Say I highlighted text from google.com... is there a way to run a script from my terminal and have that text copied and pasted into a folder that I specify on my Desktop?

3 Answers 3

2

Nah unless you overwrite the "highlight" event in your browser's code.

1
  • And im assuming that's probably a pain in the ass?
    – Anonymous
    May 24, 2011 at 1:58
1

I think this is doable (recording selected text from your browser to a file), but would require more than a terminal script. As I see it, there are two problems you need to solve:

1. Get the selected text from your browser window
I think the easiest approach to this would be to build a small chrome extension (or equivalent plugin if you use something else) that either:

2. Write the text to a file
Once the extension has your text, you then need to get that info to your desktop. There are a few approaches to this, but I suspect posting to a local server would probably be the simplest.

0

You can execute javascript directly through the address bar in your browser by typing "javascript:" and then the code. That would work on any website and it should run with enough rights to create files etc.

1
  • Not true. JavaScript executed in the address bar runs in the page currently being viewed. Content pages and JavaScript URIs cannot access local files.
    – Anonymous
    May 22, 2011 at 22:23

You must log in to answer this question.