Write quiz results to text file


I've got a request for a quiz running on several pcs/tablets. The result should be written incremental to a text file on a server. The info in this file is extracted and sorted to make a top 10 or similar shown on another display/computer. Is there a way to write the quiz results (i.e. 7/10) to a text file? I've found a javascript solution ivolving activeX, but that would not work on Android. I'm using SL 1.

8 Replies
Stefano Todaro

Hi Norm,

I understand your solution but because many say that the following code work?

You think is possible to write a file in ASCII on user PC?

I created two variables "name" and "email" I connected to a field, then I hooked a trigger javascript to keys.
I tried to use this javascript code and I'm trying to understand why it does not work:

var fso = new ActiveXObject ("Scripting.FileSystemObject");
var s = fso.OpenTextFile ("C:\\stetod.txt", 8, true);
var player = GetPlayer ();
var name = player.GetVar ("name");
var email = player.GetVar ("email");
s.WriteLine ("Email:" + e-mail);
s.WriteLine ("Name:" + name);
s.WriteLine ("==========");
s.Close ();

After publishing I uploaded it to my server.
The browser is no message warning,  I would not want the browser did not write the file!

It seems all right but not function and do not understand why!

Do you have any idea !?


Norm Cousineau

Hi Stefano that code might work if:
- you intend to write the file to the local drive (C:\)
- your Storyline is running from the C drive 
- the browser is Internet Explorer (otherwise ActiveXObject will be undefined)

"The browser has no message warning" > I think SL catches all errors.

JavaScript CANNOT write a file to your server.

Attached is something you can test locally (note a typo above "e-mail" vs "email").

Stefano Todaro

Hi Norm,

I know that with javascript I can write on my server. In that case I'll use PHP.

I know to connect an Storyline 2 object to 1 ascii file in local (for example C:\)

I know I have to use Internet Explorer.

I create ascii file before but not integrated with Storyline 2

I saw your code in writeToFile.html, i undestantand it, i tried it, but it doesn't work from Explorer. It is displayed a message for security. i agree but no file is created in C:\

I've got Karsperky Internet Security!

I tried to publish my file to CD, but no one file is created!

Tom Lynn

This is exactly what we'd also be looking to do if we were to move from Captivate to Articulate and would be the deciding matter in doing so. Our current Captivate solution uses a PHP script to write the results out to an XML file which we programmed our CRM system to parse and add to the users record. Did you get any further with this?