April 10, 2023
ADVANCED Javascript Power Unleashed: Printable document with scores!
Comments
(0)
April 10, 2023
ADVANCED Javascript Power Unleashed: Printable document with scores!
Mike Wilday is the Manager of Learning Technology Solutions at Los Angeles Pacific University. He began using adobe captivate back in 2011 as an instructional media designer and continued using the product since. He developed an instructional media that won a Silver Omni Award titled I.S. Helpdesk - Help my computer is stuck. https://omniawards.com/recent-winners and currently works freelance designing custom captivate solutions for software simulations, websites, and graphic design. 
Guide 3 posts
Followers: 6 people
(0)

I created a custom method in Javascript for sharing out assessment scores!!!! Adding the following javascript to a captivate button action allows you to create a webpage showing your participants’ results and then prompt them to print it!

My example below


// Create a new window with a blank HTML page
// Gathers variables from Captivate based on the variable name there are 5 scores we’re tracking
var score1 = window.cpAPIInterface.getVariableValue(“cat_1_self_awareness”);
var score2 = window.cpAPIInterface.getVariableValue(“cat_2_managing_emotions”);
var score3 = window.cpAPIInterface.getVariableValue(“cat_3_motivating_oneself”);
var score4 = window.cpAPIInterface.getVariableValue(“cat_4_empathy”);
var score5 = window.cpAPIInterface.getVariableValue(“cat_5_social_skill”);

// Creates and sets feedback in the document based on the scores captured in Captivated

let feedback1, feedback2, feedback3, feedback4, feedback5;

//evaluates the first score and sets feedback

if (score1 <= 17) {
feedback1 = “You should make this area a development priority.”;
} else if (score1 <= 34) {
feedback1 = “Giving attention to where you feel weakest will pay divedends”;
} else {
feedback1 = “This area is a strength for you!”;
}

 

if (score2 <= 17) {
feedback2 = “You should make this area a development priority.”;
} else if (score2 <= 34) {
feedback2 = “Giving attention to where you feel weakest will pay divedends”;
} else {
feedback2 = “This area is a strength for you!”;
}

 

if (score3 <= 17) {
feedback3 = “You should make this area a development priority.”;
} else if (score3 <= 34) {
feedback3 = “Giving attention to where you feel weakest will pay divedends”;
} else {
feedback3 = “This area is a strength for you!”;
}

 

if (score4 <= 17) {
feedback4 = “You should make this area a development priority.”;
} else if (score4 <= 34) {
feedback4 = “Giving attention to where you feel weakest will pay divedends”;
} else {
feedback4 = “This area is a strength for you!”;
}

 

if (score5 <= 17) {
feedback5 = “You should make this area a development priority.”;
} else if (score5 <= 34) {
feedback5 = “Giving attention to where you feel weakest will pay divedends”;
} else {
feedback5 = “This area is a strength for you!”;
}

//creates the webpage which will contain the scores and feedback

var win = window.open();
win.document.write(“<html><head>”+
//add the title of your page
“<title>Page Title</title></head><body>” +
// Adjust the titel of the assessment
“<h1>Your TITLE OF ASSESSMENTResults</h1>” +
“<div>” +
//adds the 5 categories and scores to the webpage using HTML
“<h3 style=’margin-bottom: 0;’><b>SELF-AWARENESS= </b>” + score1 + “</h3>” +
“<p style=’margin-top:0;’>The ability to see yourself as others see you, and have a good sense of your abilities and limitations.</br>” +
“<b>Feedback: ” + feedback1 + “</b></p>”+
“<h3 style=’margin-bottom: 0;’><b>MANAGING EMOTIONS= </b>” + score2 + “</h3>” +
“<p style=’margin-top:0;’>The ability to stay focused and think clearly even when experiencing powerful emotions.</br>” +
“<b>Feedback: ” + feedback2 + “</b></p>”+
“<h3 style=’margin-bottom: 0;’><b>MANAGING ONESELF= </b>” + score3 + “</h3>” +
“<p style=’margin-top:0;’>The ability to use your emotions to move and guide you towards your goals. </br>” +
“<b>Feedback: ” + feedback3 + “</b></p>”+
“<h3 style=’margin-bottom: 0;’><b>EMPATHY= </b>” + score4 + “</h3>” +
“<p style=’margin-top:0;’>The ability to sense, understand and respond to what other people are feeling. </br>” +
“<b>Feedback: ” + feedback4 + “</b></p>”+
“<h3 style=’margin-bottom: 0;’><b>Social Skill= </b>” + score5 + “</h3>” +
“<p style=’margin-top:0;’>The ability to manage, influence and inspire emotions in others. </br>” +
“<b>Feedback: ” + feedback5 + “</b></p>”+
“</div>”+
“</body></html>”);
win.document.close();

 

// Waits for the window to finish loading
win.onload = function () {
// Uses the window.print() function to print the page
win.print();

 

// Add a listener for the ‘afterprint’ event
win.addEventListener(‘afterprint’, function () {
// Close the window after printing
win.close();
});
};
0 Comments
Add Comment