Solved javascript create file howto

Clone / X
November 4, 2016 at 02:50:16
Specs: XP SP3, AMD Ath 64X2 2GB
javascript create file

anybody here know how?

while we're at it, how about read from file?

the hits just keep on coming

TIA

=====================

M2 Get custom script or take private lessons


See More: javascript create file howto

Reply ↓  Report •


#1
November 4, 2016 at 18:36:46
✔ Best Answer
Hi M2! This is verbatim from the file "script.chm" which I use quite regularly. My knowledge and contact with jscript is zilch.

var fso = new ActiveXObject("Scripting.FileSystemObject");
var a = fso.CreateTextFile("c:\\testfile.txt", true);
a.WriteLine("This is a test.");
a.writeline("line two");
a.writeline("3rd line of testfile");
a.Close();

reading and writing text:

var fso = new ActiveXObject("Scripting.FileSystemObject");
var ForReading = 1, ForWriting = 2;
f = fso.OpenTextFile("c:\\testfile.txt", ForReading);
junk = fso.OpenTextFile("junk", ForWriting,1);
do {
r = f.ReadLine();
junk.writeline(r);
}
while (f.atendofstream==false);
;

Unfort. jscript doesn't have the "wscript.echo", (which is very handy for debugging) as far as I know.


ps: Correction, that's script56.chm, in case you need to download it.

message edited by nbrane


Reply ↓  Report •

#2
November 4, 2016 at 23:18:42
nbrane,

Thank you for that.

I'll get to work.

=====================

M2 Get custom script or take private lessons


Reply ↓  Report •

Related Solutions


Ask Question