Thursday, June 24, 2010

Creating Folder and writtings file in JavaScript on the Client Via Active X

This function will create a folder and and Create a file inside that folder and writes the data into the file using the activex object .Inorder to do this we should enable the option on the browser -Enable active x object that marked as unsafe form the option menu of the IE


       function Callme() {
           var Tristate = 0;
           var Writing = 2;
           var myActiveXObject = new ActiveXObject("Scripting.FileSystemObject");
           myActiveXObject.CreateFolder("C:\\Myfolder");
           file = myActiveXObject.CreateTextFile("c:\\Myfolder\\erroLog.xml");
           var stringText = "";
           stringText = "";
           stringText += "\nTove";
           stringText += "\nJani";
           stringText += "\nReminder";
           stringText += "\nDon't forget me this weekend!";
           stringText += "\n";
           file.Write(stringText);
           file = myActiveXObject.CreateTextFile("c:\\Myfolder\\erroLog.txt");
           stringText = "This is a test";
           file.Write(stringText);
           return false;
       }

0 comments:

Post a Comment