It would have been helpful if you could provide the result of the script debugger, since now I have to guess what went wrong in your code.
Anyway, assuming that fsObj is correctly defined as a FileSystemObject in the global scope, I firstly recommend you to remove the check of FileExists(). This is already implemented if you set the
create attribute to true, and thus there's no need to check it yourself:
code:
var fsObj = new ActiveXObject("Scripting.FileSystemObject");
function AddLineToFile (file, line) {
var fileObj = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, /*ForAppending*/ 8, /*Create*/ 1);
fileObj.WriteLine(line);
fileObj.Close();
}
I don't know what else might be wrong with your code...