Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do u input highlighted data on webpage into a file

Status
Not open for further replies.

BondGuy

IS-IT--Management
Feb 9, 2005
10
0
0
US
Hi ,

this is the issue -

if i highlight some content on any webpage,and i do a right click,it should be inserted into a specific file.

yeah i could do a copy and paste from webpage into this file,but i was wondering if there is any script that could do it..

i dont even know if perl/php is what i should be using ..i do use activerperl..


someone worded it for me like this
"i want to create a script to be able to run as a service on your pc so every time you highlight some content and right click on it, on your browser, to save it in a file?"

Guide me ..

bond guy
 
About the closest solution that I can think of (without using plugins or other languages) would be to create a frame around all of the pages that you visit. Then insert some javascript into the frame to retreive the selected text and submit that data to a server-side script (perl/php). However, there is a security measure that keeps javascript from being able to read data from a different domain. Thus, you would have to find some way to disable this for your situation. In IE, you may be able to do this using Hypertext Applications (hta files), but I'm not sure. Also, I have no idea about how (or if) js is able to detect selected text.
Overall, this is a hack kind of solution, and I'm not sure it would even work. In addition, if it could be made to work, you lose the useage of your address bar.

A more robust solution would be as follows:

Internet Explorer:
*. Active X (not sure if it can do this)
*. Visual Basic (not sure if it can do this)
*. a plugin
*. an external program

Firefox:
*. an extension
*. a plugin
*. an external program
 
Well I toy around with javascript and it is easy to capture selected text from webpage , and store it into a variable inside javascript , only i dont know how to capture it and send it over to perl to put it into file.

like say i select text on this webpage itself e.g. "Firefox" and i want that to be added that to a text file sitting on my computer named "webinfo.txt".

thanks
bondguy
 

In IE you could use the FileSystemObject ActiveX control to do the job.

More info can be found by searching on Google for "FileSystemObject"

Hope this helps,
Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top