You need to sign in to do that
Don't have an account?

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>
<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>
Hi,
Still iam facing an issue. Please help me out.
Thanks,
Udaya
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
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