From: Terence on
I actually use Fortran for programming, and wish to call from Fortran,
any process which will permit me to call a browser, while passing an
HTM form as a file name, in order to capture the entered data. The
calling opeartion is clear and works. OPera and Internat Explores, as
samples, do the job, but the storage so far achieved is only the ascii
contents of the fields and not filed-based coded replies and texts.

I then want to repeat the process with another input, the same form
and another stored output.

Of course, I know how to do the above reqirement with a web-based or
local-based form and using the POST mechanism to get one e-mailed
message per form entry to a (any specified) mailbox via a "Submit"-
type completion button.

Now, there are very many programs involved with the form generation
and the processing of the captured data, which currently relies on the
Modzilla form-generated and coded ascii e-mailed messages with the
attached data file. So changing one program or providing anothe is
possible, but is would not be possible to change all programs (>100).

I wish to do something similar to the working "POST and receive"
process, but wish to store the produced file (in the Modzilla coding)
on a local drive (the same cpu or local office net drives).

The following code processes the simple test form and writes the named
file, but only with the ascii contents of the text fields used. I need
radio, multiple, value and text fields and I need the filed-name
prefixes to each reply as per Modzilla coding.

How can I do this?
Can anyone offere a modified version of what is a basic satrt (below)?

<script language="javascript">
function Writedata()
var fso = new ActiveXObject("Scripting.FileSystemObject");
var write_id;
write_id = document.getElementById('write_id').value ;
var s = fso.CreateTextFile(write_id, true);



name : <input type="text" name="name" value="" id="name_id"><br/>
Address : <input type="text" name="id" value="" id="id_id"><br/>
Write file to : <input type="text" name="write" value="C://formdata//
filename.att" id="write_id"><br/>
<input type="button" onclick="Writedata(this.form)" value="STORE">
From: Terence on
Sorry about the typos which seemed OK here (well, most) but not in the
From: Terence on
On Nov 12, 9:46 am, Terence <tbwri...(a)> wrote:
> Sorry about the typos which seemed OK here (well, most) but not in the
> post!

I was rather hoping somebody can contribute to this question.
The browser must have the form data content in memory, plus the labels
and probably even a buffer with the proposed POST action text block.
All I wan to do is store this buffer (in Modzilla coded format) on a
local disk drive.
From: Stefan Weiss on
On 14/11/09 03:17, Terence wrote:
> On Nov 12, 9:46 am, Terence <tbwri...(a)> wrote:
>> Sorry about the typos which seemed OK here (well, most) but not in the
>> post!
> I was rather hoping somebody can contribute to this question.

I can only speak for myself, of course, but I found your problem
description kind of hard to read. That could explain the absence of
helpful replies. I'm still not sure if I understand the question
correctly, but it looks like you want to save a text file locally with
JavaScript from a Mozilla browser (Firefox?). That's possible, but not
with the ActiveX/FSO approach. I've added an example which should save
the file for you in Firefox and IE, assuming that access is granted.
You'll need to add error handling, form validation, and proper form
serialization if your form has radio buttons, select fields, etc.

Note that the file path is now "C:/formdata/filename.att" instead of


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
<title>File save test</title>

name : <input type="text" name="name" value="" id="name_id"><br>
Address : <input type="text" name="id" value="" id="id_id"><br>
Write file to : <input type="text" name="write"
value="C:/formdata/filename.att" id="write_id"><br>
<input type="button" onclick="saveFile()" value="STORE">

<script type="text/javascript">

function getVal (id)
return document.getElementById(id).value;

function getFilePath ()
// (snip validation)
return getVal("write_id");

function getFileData ()
// (snip validation)
var data = [];
return data.join("\r\n");

function saveFile ()
var path = getFilePath(),
data = getFileData();
if (typeof this.netscape == "object"
&& typeof == "object") {
saveFile_Moz(path, data);
} else if (typeof this.ActiveXObject != "undefined") {
saveFile_ActiveX(path, data);

function saveFile_ActiveX (path, data)
var fso = new ActiveXObject("Scripting.FileSystemObject"),
file = fso.CreateTextFile(path, true);

function saveFile_Moz (path, data)
try {
} catch (e) {
alert("Local file system access denied; aborting.");
var cc = Components.classes,
ci = Components.interfaces,
file = cc[";1"]
perms = parseInt("644", 8),
if (!file.exists()) {
file.create(ci.nsIFile.NORMAL_FILE_TYPE, perms);
outStream = cc[";1"]
// ioFlags -1 indicates default mode:
// see (join)
// (join) netwerk/base/public/nsIFileStreams.idl#86
outStream.init(file, -1, perms, 0);
outStream.write(data, data.length);

From: Stefan Weiss on
On 14/11/09 08:24, Stefan Weiss wrote:
> Note that the file path is now "C:/formdata/filename.att" instead of