[Javascript] Using FileSystemObject when on-line

Rodney Myers rodney at aflyingstart.net
Tue Jun 18 10:54:09 CDT 2002


The page below works in IE6.0 in file mode but the same page, when
loaded from an on-line location, fails with the error :

Line 5:
Automation server can't create object.

The page is closely based on an example in Pure Javascript by Wyke et
al.
The object of the exercise is to prove that a local file can be written
to hard disk from a file originating on a website.

The development that will result from this will be a site restricted in
access to a group of company representatives. (i.e. It is most
definitely NOT for public use.)

Is there something I have to add?

tia

Rodney


<html><head>
<title>Write to testfso_02</title>
<script type="text/jscript" language="JScript">
<!--
// Create a FileSystemObject object.
var myFileSysObj = new ActiveXObject("Scripting.FileSystemObject");

// Create a TextStream object.
var myTextStream = myFileSysObj.OpenTextFile("c:\\temp\\testfso_02.txt",
2, true);

// Write the first string to the file.
myTextStream.Write("Hello, World!");
// Write a newline character to the file.
myTextStream.WriteBlankLines(1);

// Write a second string to the file.
myTextStream.Write("Hello, World Again!");

// Close the stream to the file.
myTextStream.Close();
//--end-->
</script>
</head>
<body>
<p>This should write to c:\temp\testfso_02.txt</p>
</body></html>







More information about the Javascript mailing list