write to file?

Giganews Newsgroups
Subject: write to file?
Posted by:  Espen (ekvalh…@online.no)
Date: Thu, 3 Jul 2003

I have this code..

But I get this message: "The activeX-component can not established the
object:  scripting.filesystemobject?
Do you know what is wrong?

function writeToFile(){
    var TristateFalse = 0;
    var ForWriting = 2;
    var myActiveXObject = new ActiveXObject("Scripting.FileSystemObject");
    myActiveXObject.CreateTextFile("c:\test.txt");
    var file = myActiveXObject.GetFile("c:\test.txt");
    var text = file.OpenAsTextStream(ForWriting, TristateFalse);
    text.Write("Hello World");
    text.Close();
}

Replies