Skip to main content
Known Participant
May 23, 2018
Question

Accessing cpInfoPercentage system variable value from the published code

  • May 23, 2018
  • 2 replies
  • 1179 views

Hello!


I am publishing a Captivate assessment as HTML5 (not SCORM packaged and no SWF) and need to be able to access the cpInfoPercentage system value (holds the quiz score as a percentage) in the published HTML/JavaScript code. Going through the published code, I am seeing where this variable is used to create the SVG image of the score number for the slide to be viewed in HTML in a browser. However, I am not sure I can grab this as a value.

Has anyone done this and can offer any guidance or code they used to make it happen / test it?

The reason I need to do this is because we are creating our e-learning courses in a way where we are either writing them in straight HTML / JavaScript or creating portions of them in Animate or Captivate and using the published code as modules inside an HTML player (basically the completed courses are a website that we package as a whole with a scorm packager). We currently are not able to use any of the assessment capability of Captivate because of the way we are creating our courses... I would like to be able to use this functionality than the what we are currently doing to create quizzes, and I could if I could capture this variable to be able to  pull into our assessment results and certificate pages (which are created in HTML/JavaScript.

Thank you so much in advance for your help!

Ali

    This topic has been closed for replies.

    2 replies

    TLCMediaDesign
    Inspiring
    May 24, 2018

    I don't know what you mean by outputted?

    Captivates output is just a single page that redraws itself for each slide.

    You need a trigger I guess that get's the value at a certain point. So my thought is that if you put your code in a slideenter listener you can check what slide you are on and get the value of the variable.

    How is it that you want it displayed?

    Known Participant
    May 24, 2018

    I am sorry that I am probably not making much sense. What I am trying to do is complicated, and I am having a hard time wrapping my head around how to accomplish it and how to explain it correctly. But, I know it can be done.

    A trigger may work. We currently have an HTML player that is able to read the published HTML5/JavaScript files and display them. We then add other content as needed and our assessment, a results page, and packaged it with SSP to put up on our LMS.

    Because of they way we are doing this, we can not currently use Captivate to create our assessments. I am trying to find a way to capture the score so that we can use it on a results page and send the value on to the LMS. If we can find a way to do that, we can use Captivate to create our assessment modules.

    So, I need a way to be able to capture that score variable value to be able to use at a later time in different code. Does that make sense?

    TLCMediaDesign
    Inspiring
    May 24, 2018

    It kind of makes sense.

    If you have a HTML player that is able to read the published files, then that variable would be available to read right along with them.

    Not sure if you really mean "read" though. If it's just in an iFrame of another html page that is used to "display" the Captivate published content, then you need code to read the content of the iFrame.

    Or you could have variables in that page and have Captivate populate them using window.parent.

    Known Participant
    May 23, 2018

    I found this code in a different forum:

    var Fbk=window.cpAPIInterface.getVariableValue("cpInfoPercentage");

    and am wondering if this is what I need.... Does anyone know if this will work using the published files from Captivate or this is meant to be used inside Captivate?

    This is the forum I got this from:

    Email quiz results variables in body of an email with JavaScript in Captivate 9

    Lilybiri
    Legend
    May 23, 2018

    That is how I transfer values of variables from Captivate when I want to use them in JS. You can find more explanation about the common API for JS in Captivate in:

    Learn about the Common JavaScript interface for Adobe Captivate

    But I think window.cpInfoPercentae will work as well.


    If you want to learn more about quizzing system variables: Using Quizzing System Variables - Captivate blog