Friday, 15 July 2011

jscript - looking to use javascript to save a webpage as a text file -



jscript - looking to use javascript to save a webpage as a text file -

it's sports site lots of text, sorting through text interests later.

the code have come across is:

<html> <body> <script language="jscript"> <!-- function open() { var result = string.empty; using (var webclient = new system.net.webclient()) result = webclient.downloadstring("http://some.url"); var myobject, afile; myobject = new activexobject("scripting.filesystemobject"); afile = myobject.opentextfile("f:\\sports.txt", 8, true, 0); afile.write (result); afile.close(); } --> </script> open text stream file sport.txt <form name="myform"> <input type="button" value="open file" onclick='open()'> </form> </body> </html>

any help appreciated, can write in other languages if needed. please direct me!!

if want write own utility script grabs content of page , downloads file, , want write in javascript, utilize node.

http://nodejs.org/

if need command-line tool that, utilize wget.

both these options run on many platforms.

javascript jscript

No comments:

Post a Comment