write to file?

E

Espen

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();
}
 
L

Laurent Bugnion, GalaSoft

Hi,
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();
}

Using ActiveX to write to files works only in IE, and only in a relaxed
security environment. Typically, this won't work in the Internet
security zone. This is probably your problem.

Change your security settings and try again.

Laurent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top