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?
Are you looking to have an auto-addressed Outlook email to pop up on the screen, with all the variable contents as the body of the email, ready for them to click on send? If so, I saw some JavaScript in here somewhere, that would accomplish that. Need that code?
Got it working where it pulls through multiple variables into the email. However it just puts them all into one huge paragraph. Is there a simple way to include line/paragraph breaks in the email content?
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)
You’ve been a massive amount of help. We got it working how we wanted in the end and I’m intending on posting the code in here when get back to my desk
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.
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.
There will be a limit to the data that can be sent (around 2000 characters including code it will just fail and give no warnings This is a limitation of Mailto
10 Replies
Hi Chris!
Are you looking to have an auto-addressed Outlook email to pop up on the screen, with all the variable contents as the body of the email, ready for them to click on send? If so, I saw some JavaScript in here somewhere, that would accomplish that. Need that code?
found it:
https://community.articulate.com/discussions/articulate-storyline/email-content-using-javascript-close-window
Thank you Dave, I'll take a look at the article. I also managed to find tis one that looks like it might also do the job.
https://community.articulate.com/discussions/building-better-courses/export-variable-values-via-email-message-using-javascript
Got it working where it pulls through multiple variables into the email. However it just puts them all into one huge paragraph. Is there a simple way to include line/paragraph breaks in the email content?
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)
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!
You’ve been a massive amount of help. We got it working how we wanted in the end and I’m intending on posting the code in here when get back to my desk
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.
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!
There will be a limit to the data that can be sent (around 2000 characters including code it will just fail and give no warnings This is a limitation of Mailto
This discussion is closed. You can start a new discussion or contact Articulate Support.