Skip to main content
Inspiring
April 25, 2018
Answered

Control the variables with Java Script from the Console in F12 - Dev Tools

  • April 25, 2018
  • 2 replies
  • 683 views

Hi there,

I can get and set variables in a project in IE Dev tools Console.

This is what commands work  for me.

//Get a variable value

cpAPIInterface.getVariableValue ("nameVariable");

//Set a Section completion variable to 1. Useful for marking a topic/section as completed

cpAPIInterface.setVariableValue('nameVariable', 1);

//Go to a slide number. The slide starts from 0 in JS and from 1 in Captivate

cpAPIInterface.setVariableValue('cpCmndGotoSlide', 2);

All the above works well when I preview the project with F11 - HTML5 in browser or just run the project locally.

Then, I deploy the project on the LMS. (SharePoint based LMS 365).

I cannot change the variables with the same commands. For instance, if I use this one

cpAPIInterface.setVariableValue('cpCmndGotoSlide', 2);


this is what I get

'cpAPIInterface' is undefined

Any ideas why this happens?

Also, how can I try this one in a Console?

SCORM_objAPI.LMSSetValue("cmi.core.lesson_status", "completed");

Thanks in advance

B

This topic has been closed for replies.
Correct answer ankits61431843

Ok open developer console using F12 and then see the "target" dropdown at the right side under the console tab. Please select frame: index_scorm.html. I hope this will work.

2 replies

ankits61431843
ankits61431843Correct answer
Inspiring
April 25, 2018

Ok open developer console using F12 and then see the "target" dropdown at the right side under the console tab. Please select frame: index_scorm.html. I hope this will work.

Inspiring
April 25, 2018

That was it. Thank you so much!

ankits61431843
Inspiring
April 25, 2018

Hi Are you using responsive course?

Inspiring
April 25, 2018

No, a normal one