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
Udaya BhaskarUdaya Bhaskar 

Help needed :Error: Number:-2146827859 Description:Automation server can't create object

Hi All,
 
I have created a button and on click of this i am trying to save a .txt file in to my local machine. PFB the code. But when i execute this, i am getting the following error.
Error: Number:-2146827859 Description:Automation server can't create object
 
Any solution on this will b really helpful.
 
Thanks,
Udaya
 
Code:
<html> 

<head> 

<script src="/soap/ajax/9.0/connection.js" 

type="text/javascript"></script> 

<script> 
function WriteToFile() { 
try { 
var fso, s; 
fso = new ActiveXObject("Scripting.FileSystemObject"); 
s = fso.CreateFolder("C:\\test.txt", true); 
s.writeline("This is a test"); 
s.Close(); 
} 
catch(err){ 
var strErr = 'Error:'; 
strErr += '\nNumber:' + err.number; 
strErr += '\nDescription:' + err.description; 
document.write(strErr); 
} 
} 
</script> 
</head> 

<body onload="WriteToFile()"> 

<div id="output"> </div> 

</body>

 
KANAKKANAK
What kind of browser do you use?
Udaya BhaskarUdaya Bhaskar
Hi,
 
I am using Internet Explorer 7.0.
 
Regards,
Udaya
KANAKKANAK
try to use this code it must work

<html>
<head>
<script src="/soap/ajax/9.0/connection.js"></script>
<script language="JScript">
function WriteToFile() {
try {
var fso, s;
fso = new ActiveXObject("Scripting.FileSystemObject");
s = fso.CreateTextFile("C:\\test.txt");
s.WriteLine("This is a test");
s.Close();
}
catch(err){
var strErr = 'Error:';
strErr += '\nNumber:' + err.number;
strErr += '\nDescription:' + err.description;
document.write(strErr);
}
}
</script>
</head>
<body onload="WriteToFile()">

<div id="output"> </div>

</body>
</html>
KANAKKANAK
If it does not work, please let me know. I have another idea
gsickalgsickal
You probably have a setting in IE that is preventing you from running the activex control.  Go to Tools...Internet options...Security and look at the section called "ActiveX Controls and Plugins" and make sure they are allowed to execute...
Udaya BhaskarUdaya Bhaskar

Hi,

Still iam facing an issue. Please help me out.

Thanks,

Udaya

 

 

KANAKKANAK
Sorry, but if your error message still after you use this two help's messages, then you have some problems with your Internet Exlporer. Try to use this code on another PC.
Udaya BhaskarUdaya Bhaskar
Hi Kanak,
 
Are u able to run the s-control in your login..please reply me at your convenience.
 
Thanks,
Udaya
Udaya BhaskarUdaya Bhaskar

Hi,

I m able to test the code without any issues by running from a html page on my local machine.But when i try this from an S-control it is giving me this error.

Try to check this at your leisure. Thanks a lot for all the help.

Regards,

Udaya

 

 

 

 

TheDevLifeTheDevLife

Udaya,

 

I have used this ActiveX Object in an S-Control before and ran into the same issue. You have to really turn down the browser security. So you go into IE and lower the security settings for all of the zones. I had to play with the settings for awhile to get the right ones but I did finally get it to work (using IE6).

 

Randy