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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Schedule download of a text file

Status
Not open for further replies.

Scorez2000

Programmer
Feb 5, 2004
87
GB
Hi All, just wondering if any of you gys could help me with this problem. It might be do-able with ASP.

We have a windows 2000 wev server here. Everyday we log onto that web server, open a web page ( and copy the text from the page and then paste it into a text file on our server.

Does anyone know anyway of doing this automatically. We would like to schedule it and run it each day. I've been told we could script this in an ASP page, but with my limited ASP skills, I don't know how to. I was also told that a batch file could be written to do it, but don't know what commands to use.

The text on the webpage is not accessible via FTP, otherwise we could probably do this much easier.
 
The best way is probably to create a Scheduled Task that launches a .VBS file.

Your VBScript file will create an instance of the xmlhttp object that it uses to request the remote web page, then it will use the FileSystemObject to get a TextStream that it will use to write the output.
 
I think that using a .VBS is better than using basically the same code in an ASP because it is just one less thing in the chain of execution ... the fewer links in the chain the less likely something will break and the easier it is to track down any issue.
 
Would anyone have any links on how to do this in VBS? Or any code?
 
You can write VBScript for a .VBS file in almost the same way you do it for ASP.

One notable exception is that in ASP you create an instance of an object with [tt]Server.CreateObject()[/tt] but in a regular VBS you just use [tt]CreateObject()[/tt] by itself.

So, to create instances of FSO and xmlhttp, you would do:
Code:
Dim oFSO, oXML
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oXML = CreateObject("MSXML2.XMLHTTP")

You can use the Search feature of this forum to find out lots of things about FSO and XMLHTTP or you can look on MSDN or even google to find the complete documentation.

All you have to do to make a .VBS file is to open up Notepad, write the code, and save it with the .VBS extension... except for the extension it is just a plain text file.

For more information about VBScript, you might also try the tek-tips forum that concentrates on that subject: forum329
 
Ok, thanks for the advice. I'll follow that up. Much appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top