JavaScript not writing a .txt file
Mar 26, 2014
I've been trying without success to get JavaScript code to save a Storyline variable to a .txt file, in a CD-published program.
I used the exact code given in the Support page at http://www.articulate.com/support/storyline/javascript-best-practices-and-examplesbut it's not writing a txt file. I've looked through the various threads on this but I'm still stuck. It also doesn't work on other Windows machines. Is there perhaps a security setting I need to change which is preventing file creation on the hard drive? If so, it's going to cause user problems later.
My JavaScript code is below, I set the SL variable 'First' to a name:
var fso = new ActiveXObject("Scripting.FileSystemObject");
var s = fso.OpenTextFile("C:\\Test.txt", 8, true, 0);
var name = player.GetVar("First");
s.WriteLine("Name: " + name);
s.WriteLine("==========");
s.Close();
I would appreciate your ideas and help. Does this code write a .txt file in your hard drive root directory?
Many thanks, Tim
1 Reply
Can anyone suggest what I'm doing wrong here? Does this code work for you? Or can you suggest code which works?
Thanks, Tim
This discussion is closed. You can start a new discussion or contact Articulate Support.