|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Save Selected Text in a Variable?
Hi there!
Quick question: is it possible to use Python to read highlighted text, and then save it as a variable within the program? For example, I have a Python robot with text-to-speech capabilities. Would it be possible for me to highlight, say, a paragraph on a website in Firefox, run my Python program, and have it read what's selected? I just need a way to capture the selected text. What is the best way of doing this? Is it even possible? Thanks! |
|
#2
|
|||
|
|||
|
The easiest way would be to copy the text to the clipboard and have your Python bot read from the clipboard.
The best way ... don't know, something like a FireFox extension, but I don't know where you'd start with that. A bit of a hack might be a bookmarklet that has javascript to send the selected text to a server - and have your Python bot implement a listening server. Probably easier to have the javascript copy the text to the clipboard, really. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Save Selected Text in a Variable? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|