OK for future use to other guys this is the final code:
This script gets any Text file from a remote server anyware and saves it into a file in your hard drive.
The function:
function GetNewData(address,fileloc) {
var objFSO, resposta, temp, TextFile;
try {
temp = new ActiveXObject("ADODB.Stream");
objFSO = new ActiveXObject("Scripting.FileSystemObject");
resposta = new ActiveXObject("Msxml2.XMLHTTP");
TextFile = objFSO.CreateTextFile(fileloc);
resposta.open("GET",address,false);
resposta.send();
temp.Type = 1;
temp.Open();
temp.Write(resposta.ResponseBody);
temp.Position = 0;
temp.Type = 2;
temp.Charset = "ascii";
TextFile.write(temp.ReadText());
temp.Close()
TextFile.Close();
}
catch(e){
alert("Failure while updating the DataBase!\nDescription: "+e.description);
return;
}
}
The Caller:
GetNewData("http://someserver/yourpage.html" , "c:\\yourfolder\\yourfile.EXT");
OK! That's All Folks! :)
|