Saving file using JScript and ActiveX





4
Date Submitted Tue. Oct. 10th, 2006 3:49 PM
Revision 1 of 1
Beginner Archatas
Tags ActiveX | HTA | IE | JScript
Comments 0 comments
This JScript code could be used in HTML applications (HTA) or other user-trusted web applications for saving data into files.

var MODE_READ = 1, MODE_WRITE = 2, MODE_APPEND = 3;
var TRISTATE_DEFAULT = -2, TRISTATE_TRUE = -1, TRISTATE_FALSE = 0;
var oFileSys = new ActiveXObject("Scripting.FileSystemObject");
oFileSys.CreateTextFile("C:\\some\\path\\to\\file.txt");
var oFile = oFileSys.GetFile(sOutputFilePath);
var oTextStream = oFile.OpenAsTextStream(MODE_WRITE, TRISTATE_DEFAULT);
oTextStream.Write("TEST");
oTextStream.Close();
 

Aidas Bendoraitis

aaiddennium.com/blog/

Comments

There are currently no comments for this snippet.

Voting