javascript - OpenTextFile gives error Automation server can't create Object -
i created method create text file log page has different buttons call functions parameters different textfields:
function writetofile(data) { var currentdate = new date(); var datetime = "time: " + currentdate.getdate() + "/" + (currentdate.getmonth()+1) + "/" + currentdate.getfullyear() + " @ " + currentdate.gethours() + ":" + currentdate.getminutes() + ":" + currentdate.getseconds(); var fso = new activexobject("scripting.filesystemobject"); var = fso.opentextfile("c:\\logs\\log.txt", 8); a.writeline(datetime); a.writeline(data + "\n"); a.close(); }
and works fine when i'm using c: drive. unfonrtunately, used in production in z: drive other people can use page well. when copy z: drive , change line:
var = fso.opentextfile("c:\\logs\\log.txt", 8);
to following:
var = fso.opentextfile("z:\\logs\\log.txt", 8);
it gives me error saying:
automation server can't create object
i using ie8. ideas on i'm doing wrong , how can fix this?
Comments
Post a Comment