2

I cannot to write data from IE to a local file. I have next problem: when I create html page with next content

<html>
<head>
<title>File's saving</title>
  <SCRIPT>
function cf_random() {
b="c:\\file.txt";

var fso, f1; 
fso = new ActiveXObject("Scripting.FileSystemObject");
f1 = fso.CreateTextFile(b, true);

f1.WriteLine("Testing") ;
document.writeln("File " + b + " is created.");
}
  </SCRIPT>


</head>
<BODY>
<input type=button value="Create file" onClick="cf_random()">
</body>
</html>

it works great, but when I try the same code with extern js file that I attach to site using bookmarklet - I get an error SCRIPT429: Automation server can't create object(code bellow)

javascript: (function() {
    var s2 = document.createElement('script');
    s2.src = 'http://192.168.0.100/jquery.js';
    document.body.appendChild(s2);
})();

$(document).ready(function(){    
b="c:\\file.txt";
var fso, f1; 
fso = new ActiveXObject("Scripting.FileSystemObject");
f1 = fso.CreateTextFile(b, true);
f1.WriteLine("Testing") ;
document.writeln("File " + b + " is created.");
});

What can be wrong?

abilash
  • 897
  • 3
  • 12
  • 32
  • I wouldn't recommend writing to a file on a client machine using scripts. – Harsha Venkataramu Oct 06 '12 at 16:18
  • I try to explain. It's code I'll not be using on my site. It's code it's just for my local machine. I try to parse, with js code, web page that currently loaded in my browser(not my page, it's can be google page for example) and than write obteined results to extern file. So I need to write to the file. – abilash Oct 06 '12 at 16:23
  • Maybe this will help? http://stackoverflow.com/questions/10193532/javascript-how-to-append-data-to-a-file – Harsha Venkataramu Oct 06 '12 at 17:02

1 Answers1

1

I solved this problem. It's just secrity settings.

abilash
  • 897
  • 3
  • 12
  • 32