help please - How to export multiple 'text variables' into an email (SL3)

Sep 19, 2019

Hi all, I have a course I'm developing (Storyline 3) where we have built a notepad so that the learner can add notes as they go through. There are around 8 different note areas (set up as individual 'text variables'). We want to enable the learner to send themselves an email (or output to a word doc or similar) containing the content of their notepad (ie. all the variables). Does anyone know how to do this?

Any help very greatly appreciated.

10 Replies
dave faldasz

var body_txt=body_start[1] + body_start[2] + "%0D%0A%0D%0A" + body_start[3] + body_start[4] + "%0D%0A%0D%0A";

found it here (and tried it)
how to make new paragraphs seen on:
https://community.articulate.com/discussions/articulate-storyline/javascript-mail-function-worked-fine-in-sl2-but-does-not-work-in-sl360-can-anyone-help

the magic is using   %0D%0A for a line break

meanwhile, I broke mine playing around:
window.location.href = mailto_link; is not working to open an email
win=window.open(mailto_link,"emailWin"); is not working to open an email
there 's a moral here: save my work frequently (lol)

dave faldasz

Hi Chris!
oh yeah;
I needed this line too:

var mailto_link='mailto:'+email+'?subject='+subject+'&body='+body_txt;

and it appears the
window.location.href = mailto_link;
works only if I already have Outlook open - but not if it is closed.

don't know what to put, so that it will open an Outlook email without having Outlook open already. I am creating more questions than answers here...

hope some of that helps!

Chris Undery

For anyone coming across this thread this is what ended up working for us. The italic underlined text is my explanation of what I think each bit does.

var player = GetPlayer(); 

var email=player.GetVar("email_who"); email_who is the name of the text variable in SL3 that determiens the email address that the email goes to

var subject=player.GetVar("Email_Subject"); email_subject is the name of the text variable that determines the subject  line of the email

var body_start=new Array(); no idea but it works - think it allows us to include mutliple variables - from here down is the body of the email

body_start[1]=player.GetVar("Comments_Learner_Outcomes"); Comments_Learner_Outcomes is the name of the variable to include in the body of th eemail

body_start[2]=player.GetVar("Comments_General"); as above but 2nd variable to include in body of email

body_start[3]="%0D%0ATESTING TESTING PRE-DEFINED TEXT"; %0D%OA creates a line break - include this code twice to add a paragraph break. Inlcuding text just within "EG THIS TEXT" will include that pre-defined text in the body of the email. we used it here to create a title for the variable

body_start[4]=player.GetVar("Comments_Story");

var mailto_link='mailto:'+email+'?subject='+subject+'&body='+body_start.join(" ");
win=window.open(mailto_link,'emailWin'); tells it to create the email based on the above. When the learner clicks send the email will pre-populate in outlook but they will need to hit send in outlook to actually send it.

Brian Allen

Chris this is amazing... when I first ran across your question I *almost* replied that I didn't think this could be done from storyline dependably (different browsers, operating systems and email clients) but then I decided to just follow the thread and see what developed from the conversation.

I love this outcome and will definitely be saving/bookmarking this thread in case I have a need to do something similar in the future.

Thanks for sharing this here!

This discussion is closed. You can start a new discussion or contact Articulate Support.