Connecting Tech Pros Worldwide Forums | Help | Site Map

write to file?

Espen
Guest
 
Posts: n/a
#1: Jul 20 '05
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();
}



Laurent Bugnion, GalaSoft
Guest
 
Posts: n/a
#2: Jul 20 '05

re: write to file?


Hi,

Espen wrote:[color=blue]
> 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();
> }[/color]

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
--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Closed Thread