function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Apex codingApex coding 

How to use Scripting.FileSystemObject(ActiveX object ) in salesforce

HI
Iam trying to read a file on my local machine using java script
Here Im using Scripting.FileSystemObject (ActiveX object)
 
Here I am getting an error like Automation server cannot create object
 
how to solve the issue. your help is greatly appreciated
 
Here is the code what I have used and help me in fixing the error
 
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <script type="text/javascript" src="/js/functions.js"></script>
    <script src="/soap/ajax/12.0/connection.js"></script>
    <script> 
function ReadFileToString(strFileName) {
    var strContents;
    strContents = "";
    objFSO = new ActiveXObject("Scripting.FileSystemObject");
    if (objFSO.FileExists(strFileName)) {
        strContents = objFSO.OpenTextFile(strFileName, 1).ReadAll();
    }
   
    document.getElementById('filestr').innerHTML = strContents;
} //end of function
   
    </script>
   
</head>
<body onload=ReadFileToString('C:\createDocument.txt')>
<div id=filestr>
   </div>

</body>
</html>
 
 
 
 
regards
sunil
SuperfellSuperfell
You can't (and think about it, you really really don't want this to work), the browser sandbox will disallow access to local resources for scripts from the internet.