mrpitcouk — 2011-07-27T06:08:18-04:00 — #1
var ForReading = 1, ForWriting = 2, ForAppending = 8;
var TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0;
var fso = new ActiveXObject("Scripting.FileSystemObject");
alert('C:\\\\RoyalMailDirectFeed\\\\Result.txt'); //************** LINE1 **********/
var fsoNew = new ActiveXObject("Scripting.FileSystemObject");
f1 = fsoNew.OpenTextFile('C:\\\\RoyalMailDirectFeed\\\\Result.txt', ForReading, true);
resultCode = f1.ReadLine();
resultTrack = f1.ReadLine();
resultMessage = f1.ReadLine();
Check LINE1 - if I put this alert - script works fine fileexists works and so is the rest of the code. If I remove/comment alert in LINE1 - script can not find the fileexists or not....
Same code works fine in IE9 without alertbox. It is driving me crazy.
I have tried putting filepath in variable and using variable instead of providing path itself - the result is same.
FSO usage is allowed in IE8 options settings to run activex objects ( as it works fine with alertbox appearing first )
Thanks for reading long descriptions. Any help is welcome
overthemike — 2011-07-27T12:37:19-04:00 — #2
That's pretty weird...
I've never worked with that before, so I'm not sure really what's going on, but I noticed you're declaring two fso's and only using one. Since the script works when you have the alert in there, and that alert happens to be between those two declarations, I wonder if it has something to do with that? Try getting rid of the first fso declaration along with the alert and see what you come up with.
mrpitcouk — 2011-07-27T17:09:09-04:00 — #3
I can assure you that I have tested with only one FSO instance but did not work so I thougth let me give it a try making new instance as well. but same result.
Thanks for reply and hope more members will come forward to help.
paul_wilkins — 2011-07-27T21:54:08-04:00 — #4
Activex objects aren't dealt with here, primarily because they are supported only on Internet Explorer with Microsoft's jscript language. Most other web browsers just don't support activex objects.
You might be able to get some help from Microsoft's own page about it though.
ActiveXObject Object (Windows Scripting - JScript)