I
iMath
How to get the selected text of the webpage in chrome through python ?
How to get the selected text of the webpage in chrome through python ?
How to get the selected text of the webpage in chrome through python ?
Chrome is a browser, is it not... If you want to get the text in
Python, you have to write the equivalent of a browser -- something that
parses the returned HTML message, extracting the parts you want.
How to get the selected text of the webpage in chrome through python ?
How to get the selected text of the webpage in chrome through python ?
What you need is a way to get selected text from wherever it comes. The
way to do this depends on your graphical environment. If you use X, i'd make a
a quick and dirty call to xclip -o, although there must be a pure python
implementation which in turn depends on the python framework you play
with (gtk/qt/wx/tk/...).
Short answer is : it depends on your system, and it may be easier and more
portable if you use a graphical toolkit.
cheers.
What you need is a way to get selected text from wherever it comes. The
way to do this depends on your graphical environment. If you use X, i'd make a
a quick and dirty call to xclip -o, although there must be a pure python
implementation which in turn depends on the python framework you play
with (gtk/qt/wx/tk/...).
Short answer is : it depends on your system, and it may be easier and more
portable if you use a graphical toolkit.
cheers.
To get a selection, you can either wait till it's copied to the
clipboard, and get it from there, or you can write a addon for the
application. Since Chrome accepts addons, I suggest you research that
angle. Probably mozilla.org is the place to start, and function
nsISelectionController::GetSelection() might be some place to examine.
You might find some hints in
http://stackoverflow.com/questions/2671474/range-selection-and-mozilla
if you are going to work with the clipboard, realize that it works quite
differently from one OS to another, and even from one desktop manager to
another.
--
DaveA
To get a selection, you can either wait till it's copied to the
clipboard, and get it from there, or you can write a addon for the
application. Since Chrome accepts addons, I suggest you research that
angle. Probably mozilla.org is the place to start, and function
nsISelectionController::GetSelection() might be some place to examine.
You might find some hints in
http://stackoverflow.com/questions/2671474/range-selection-and-mozilla
if you are going to work with the clipboard, realize that it works quite
differently from one OS to another, and even from one desktop manager to
another.
--
DaveA
i think you need to explain your requirement further
also what do you want to do to the text once you have it?
--
Genius is one percent inspiration and ninety-nine percent perspiration.
-- Thomas Alva Edison
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.