Copy link to clipboard
Copied
I am trying to email a Captivate 2019 variable, "cpquizinfopointsscored". I have tried all the javascripts found in my searches, but none work. Here is my current script....
var email="setname@mycompany.edu"; var subject="Final Score";
var myscore=window.cpAPIInterface.getVariableValue("cpQuizInfopointsscored");
var body_start="Final Score:%20";
var body_end=myscore;
var mailto_link='mailto:'+email+'?subject='+subject+'&body='+body_start +body_end;
win=window.open(mailto_link,'emailWin');
This is in Advanced Actions. The user clicks on a Click Box to run the script and open an email ready to just hit send. I defined “myscore” as a user variable.
First off, no matter what script I run I get….
And the email does not open. I have tried various scripts, sometimes the email will pop up but the “myscore” is not populated, just say myscore. I’m not familiar with javascript so I just basically copied and pasted ones I have found and replaced with my info.
I use the cpquizinfopointsscored within the project and the score is correct. Another point is I have reporting turned off for this project since it is not on any LMS but a standalone.
What am I doing wrong?
Copy link to clipboard
Copied
I will not answer about the script, but the system variable is cpQuizInfoPointsscored and like all variables it is case sensitive.
Copy link to clipboard
Copied
Hi there Cathie,
I think you may be misunderstanding how the Captivate Action you referred to actually works. By default, the Send e-mail to action is only designed to spawn a new email in the end user's default email client software (e.g. Outlook or Mail). It does not automatically send the email message. That requires the end user interacting with the e-learning module to execute the send, which would also allow them to change any part of the message (e.g. the score).
Captivate's Send email to action does allow you to have some very limited control over who the email is addressed to and what text appears as the subject line. But it doesn't really give you the ability to customise the body of the message and insert system variables or custom user variables. And the mailto: function cannot be relied upon unless you already know which email client your end users have on their system. It might work for MS Outlook, but it would not work if they were using a web-based email application like Gmail, etc.
Yes it is possible with Javascript to do a lot more that Captivate allows, but if you are not a JS programmer or have a friend who is, then you would likely need to pay someone to help you create that functionality. You would also need to have access to an email gateway to which your generated emails are sent. Again, this is not something that Captivate offers out of the box.
Copy link to clipboard
Copied
I understand that the email will not be automatically sent. That is not the issue. I want the email to populate with a Capitavate Varible and the user hit send.
Copy link to clipboard
Copied
As I mentioned earlier, Captivate doesn't do what you want out of the box. That kind of functionality requires custom JavaScript programming. If nobody here is able to provide you with that code and instructions about what to do with it, then you may need to consider engaging the services of a programmer.
Copy link to clipboard
Copied
You can only run JavaScript in HTML - you need to use "Preview" > "HTML 5 in Browser" or you can "Publish" > "Publish to Computer" and then upload the ZIP file to your LMS ansd view it thru that