Importing and retaining variables

Jun 06, 2012

Is there a way to import variables from external files.  I want to design a review game that instructors can input thier questions into a Storyline presentation from a text file. I want to setup a template game that can be used for any question review.

I'm not sure if this is related to the above question but I would also be interested in being able to save variables so when the Storyline is re-opened it retains variables from the last time it was open. 

29 Replies
Bruce Holliday

Hi,

Try this code  to get the name from the lms. You can see how to display either first name only or full name.

//get user name
//grab the LMS object

var lmsAPI = parent

//ask the LMS object to get the name

var rawName = lmsAPI.GetStudentName();

//the name comes very formal "Last, First"
//we will fix that by sticking the name into an array
var nameArray = rawName.split(",")
//then we save it the other way round "First Last"
var niceName = nameArray[1] +" "+nameArray[0];

//now we grab the Articulate player

var p = GetPlayer();

Cleighton SIVA

Hello in your code

var fso = new ActiveXObject("Scripting.FileSystemObject");
var s = fso.OpenTextFile("C:\\Test.txt", 8, true, 0);

is it possible to use the variable  name in the file path in place of the file name "Test"?

I want the data to be written to a text file that reflects the participant's name.  If possible what is the JavaScript code that would do this?

 

Thanks

Cleigh