If you'd like to take this concept further, you can also do things like grab the users name from the LMS to use it these emails, note system info which may help during QA/testing and create custom reports based on the learner's performance.
I appreciate & value the examples, comments, and assistance given. I am in need of some help right now. I am trying to implement some javascript into a project - to allow users to email themselves 'notes' taken throughout the course. Definitely a rookie at using code; here's what it looks like: (attachments)
Hi there! If we have multiple text entry variables in a Storyline file, would this script work to generate one email with all the variables? Or is there a way to generate one email or one file with all of the text entry variables within a course? (Javascript novice here!)
I have found that I have to be very conservative about the number of characters that get passed into the email. Things start getting cut off at a certain point and it seems like it might be different depending on the default email client (Outlook/Gmail/WebOutlook, etc.). I try to keep it under 1,000 characters.
Yes, that's correct Sherri. This is due to the mailto: spec, which unfortunately doesn't specify a max-length. You can find out more about that here.
I don't use the mailto: approach very often for this reason. If I need to capture lots of info from SL variables, I'd normally output to PDF and then use an external server to send that via email if needed.
Yes! That's exactly what I do. I love this solution and use it regularly as a quick reflection activity for learners to email to their supervisors, but as you said, if I need something to have a lot of characters, I output to PDF and have the learners send it as an attachment.
My script works only on the pc. I publish it in articulate review. Can this be the reason?
var player = GetPlayer(); var email = 'my email' var score = player.GetVar('ergebnis'); var nam = player.GetVar('name2'); var subject = 'I '+ nam + ' want to join RATIONAL installation training'; var emailBody = 'My total score is: ' + score +' % '; var mailto_link = 'mailto:' + email + '?subject=' + subject + '&body=' + encodeURIComponent(emailBody); win = window.open(mailto_link, 'emailWin');
Can anyone point me in the right direction of where to start if I wanted to grab data from my LMS - specifically Moodle. For example, the learner's name.
I am making a Human Trafficking course and want to be able to email resources to a student if they would like the PDF. Is there a way that can be done? Thank you
Hi Thomas! Not sure about the JavaScript side of things, but wanted to share (in case it's an option) that you can also add the PDF as a resource in the Player so learners can download it if they want to. Just an idea!
You're welcome, Thomas! Also, it looks like your email signature came through when you replied via email. You may want to pop in, click Edit and remove any personal information you don't want to share with the community.
71 Replies
Hi Matthew
I'm having an issue - i can't get the cc or the subject line to populate:
https://mattsmeeth1.s3.eu-west-2.amazonaws.com/story.html
Here's the code, can you help spot what's wrong? I'm new to Javascript!
var player = GetPlayer();
var A = player.GetVar('A');
var B = player.GetVar('B');
var C = player.GetVar('C');
var email1 = player.GetVar('Email1');
var email2 = player.GetVar('Email2');
var ImprovementAreas = player.GetVar('ImprovementAreas');
var MidwifeReviewed = player.GetVar('MidwifeReviewed');
var ReviewDate = player.GetVar('ReviewDate');
var ReviewingMidwife = player.GetVar('ReviewingMidwife');
var subject = 'Scoring Tool for Documentation Audit: Midwifery out-patient ante natal care';
var emailBody = 'Midwife Reviewed: ' + MidwifeReviewed + '\n' + '\n' + 'Reviewing Midwife: ' + ReviewingMidwife + '\n' + '\n' + 'Review Date: '+ ReviewDate + '\n' + '\n' + 'Audit Result:' + '\n' + '\n' + 'Answer A: ' + A + '\n' + 'Answer B: ' + B + '\n' + 'Answer C: ' + C + '\n' + '\n' + 'Areas for Reflection:' + '\n' + ImprovementAreas + '\n' + '\n' + 'Descriptor reminder:' + '\n' + '\n' + 'Mostly Answer A:' + '\n' + 'Very Well done' + '\n' + 'Keep up the good work' + '\n' + '\n' + 'Mostly Answer B:' + '\n' + 'Satisfactory' + '\n' + 'Some areas for improvement required to your documentation' + '\n' + '\n' + 'Any Answer C given:' + '\n' + 'Unsatisfactory' + '\n' + 'Some major areas of concern' + '\n' + 'Action plan to be made with manager including regular repeat documentation audit';
var mailto_link = 'mailto:' + email1 + '?cc' + email2 + '?subject=' + subject + '&body=' + encodeURIComponent(emailBody);
win = window.open(mailto_link, 'emailWin');
setTimeout(function() { win.close() }, 100);
Hi Matt,
Your mailto_link should be:
var mailto_link = 'mailto:' + email1 + '?cc=' + email2 + '&subject=' + subject + '&body=' + encodeURIComponent(emailBody);
Hello Matt & Staff & Others,
I appreciate & value the examples, comments, and assistance given. I am in need of some help right now. I am trying to implement some javascript into a project - to allow users to email themselves 'notes' taken throughout the course. Definitely a rookie at using code; here's what it looks like: (attachments)
In file - on slide 20
Thank you all!
Hi there! If we have multiple text entry variables in a Storyline file, would this script work to generate one email with all the variables? Or is there a way to generate one email or one file with all of the text entry variables within a course? (Javascript novice here!)
Yes, that’s correct Laura. You can include as many variables as you want.
I have found that I have to be very conservative about the number of characters that get passed into the email. Things start getting cut off at a certain point and it seems like it might be different depending on the default email client (Outlook/Gmail/WebOutlook, etc.). I try to keep it under 1,000 characters.
Yes, that's correct Sherri. This is due to the mailto: spec, which unfortunately doesn't specify a max-length. You can find out more about that here.
I don't use the mailto: approach very often for this reason. If I need to capture lots of info from SL variables, I'd normally output to PDF and then use an external server to send that via email if needed.
Yes! That's exactly what I do. I love this solution and use it regularly as a quick reflection activity for learners to email to their supervisors, but as you said, if I need something to have a lot of characters, I output to PDF and have the learners send it as an attachment.
Hi Matthew,
many thanks for this; it works.
But, what should I add for IOS devices for the last line?
win = window.open(mailto_link, 'emailWin');
many thanks in advance
Hi Bernadette,
That code will work just fine on IOS, no need to change a thing.
Thanks, but I try it on my I phone and nothing happens…No email opens…
I just tested the demo from my original post on my iPhone and it worked as expected (https://matthewbibby.s3.ap-southeast-2.amazonaws.com/posts/2016/07/03/Populating%20an%20email%20with%20content%20from%20Storyline/story.html)
Thanks Matthew, I saw your demo is working well.
My script works only on the pc. I publish it in articulate review. Can this be the reason?
var player = GetPlayer();
var email = 'my email'
var score = player.GetVar('ergebnis');
var nam = player.GetVar('name2');
var subject = 'I '+ nam + ' want to join RATIONAL installation training';
var emailBody = 'My total score is: ' + score +' % ';
var mailto_link = 'mailto:' + email + '?subject=' + subject + '&body=' + encodeURIComponent(emailBody);
win = window.open(mailto_link, 'emailWin');
You are missing a semicolon on line 2. review shouldn't stop this working what errors do you get in the console?
Hi,
it works now because I change the trigger to “press button”.
With start time line as the trigger it doesn´t work.
Many thanks for your affords
Does anyone know how to force form variables into a browser window that opens gmail?
Can anyone point me in the right direction of where to start if I wanted to grab data from my LMS - specifically Moodle. For example, the learner's name.
Thanks in advance
Matt
I am making a Human Trafficking course and want to be able to email resources to a student if they would like the PDF. Is there a way that can be done? Thank you
Hi Thomas! Not sure about the JavaScript side of things, but wanted to share (in case it's an option) that you can also add the PDF as a resource in the Player so learners can download it if they want to. Just an idea!
Thank you
You're welcome, Thomas! Also, it looks like your email signature came through when you replied via email. You may want to pop in, click Edit and remove any personal information you don't want to share with the community.