Syntax of ActiveXObject object:
|var newObject = new ActiveXObject(servername.typename[, location])|
The Active object takes three parts:
servername - the name of the application providing the object. It is required.
typename - the type or class of the object to create.
location - the name of the network server where the object is to be created.
Here, we have taken servername as 'Scripting' and typename as 'FileSystemObject':
Here is the code:
var object = new ActiveXObject("Scripting.FileSystemObject");
var file = object.CreateTextFile("C:\\Hello.txt", false);
file.WriteLine('Hope is a thing with feathers, that perches on the soul.');
<input type="Button" value="Create File" onClick='createFile()'>
Output will be displayed as:
Liked it! Share this Tutorial