Forum Discussion
Importing and retaining variables
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
- PhilMayorSuper Hero
Robin
The easy one first if you use an LMS or flash cookie, and enable this in the publish settings, the variables will be saved, in the case of flash cookie it is machine specific.
You can read in variable from a text fileusing a javascript trigger, this should get you started http://www.articulate.com/support/kb_article.php?product=st1&id=llwes8cn32vg
- MarkBaranowskiCommunity Member
Does anyone have a direct answer to this?
"Is there a way to import variables from external files?"
I would like to see a javascript example please.
- PhilMayorSuper Hero
Yes you can import from external data sources, the only one I have to hand is this one, this reads from the LMS and brings in the users name
- JayDharapCommunity Member
Hi Phil!
This is just what i was looking for...only that i want to use the first name only.
I published ran this on my LMS (Cornerstone) and got the page (attached).
I am clueless about JS so any idea why I see that undefined bit before my name?
Because wanted to use just the first name so I tried editing the line to var newName = array[1];
but that did not work, all I got on that slide was a NULL.
Any idea how I can get that JS to show just the first name?
- MarkBaranowskiCommunity Member
Thanks Phil - nice try - not quite what I was looking for.
I was thinking locally - like loading or saving to a text file.
I've found some script for saving to a text file.
It's the loading part I'm not sure of.
- JohnMCommunity Member
M Baranowski said:
I've found some script for saving to a text file.
It's the loading part I'm not sure of.
M,
Would you be willing to share that script you found for writing to a text file?
- MarkBaranowskiCommunity Member
I got this script off this blog: http://www.articulate.com/support/kb_article.php?product=st1&id=llwes8cn32vg
Save Storyline variables to a text file
var fso = new ActiveXObject("Scripting.FileSystemObject");
var s = fso.OpenTextFile("C:\\Test.txt", 8, true, 0);
var name = player.GetVar("TextEntry");
var email = player.GetVar("TextEntry1");
s.WriteLine("Email: " + email);
s.WriteLine("Name: " + name);
s.WriteLine("==========");
s.Close(); - MiriamHappeCommunity Member
Mark, were you ever able to figure out how to import variables from an external source? Our company uses SiteMinder to autenticate users. I want to be able to get the user name from SiteMinder (our IT guys assure me they can write the variable, but need some way to pass it to Storyline).
Hi Miriam! I'm not sure if Mark is subscribed to this thread, so you may need to shoot him a PM.
- MarkBaranowskiCommunity Member
HI Miriam,
Sorry for the delay in posting - was really busy today.
Luckily - the client went a different way with their project and I never had to import from a v ariable in a txtt file via javascript.I have seen some examples on this blog of using Flash within Storyline and importing data from XML - but Flash won't work on iPad.
Bye!
Thanks Mark for chiming back in!
Related Content
- 12 months ago
- 12 months ago
- 12 months ago
- 12 months ago
- 12 months ago