Highlighted

Saving progress through Captivate

New Here ,
May 20, 2015

Copy link to clipboard

Copied

Hi,

I am working on a course which will contain a lot of slides, which will inevitably require the user to spend quite a lot of time on the course.  The course has been split into different modules within this file.  I have achieved this by having buttons which direct to the slides where each of the modules start.  After the user has read all of the slides relating to this particular module, there is then the option to go back to the main menu where the module they have just read will now be "checked" (done by a simple variable and advanced actions to show a check mark once the final slide is read). 

But my main question is:  is there a way to save the progress as the user goes through the captivate file?  So if the user re-opens the Captivate file, the check marks will still be there?  Hope this makes sense.

Thanks

Views

579

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Saving progress through Captivate

New Here ,
May 20, 2015

Copy link to clipboard

Copied

Hi,

I am working on a course which will contain a lot of slides, which will inevitably require the user to spend quite a lot of time on the course.  The course has been split into different modules within this file.  I have achieved this by having buttons which direct to the slides where each of the modules start.  After the user has read all of the slides relating to this particular module, there is then the option to go back to the main menu where the module they have just read will now be "checked" (done by a simple variable and advanced actions to show a check mark once the final slide is read). 

But my main question is:  is there a way to save the progress as the user goes through the captivate file?  So if the user re-opens the Captivate file, the check marks will still be there?  Hope this makes sense.

Thanks

Views

580

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
May 20, 2015

Copy link to clipboard

Copied

If you are not using and LMS then you would need to implement local storage. You can save the variable that you use to control the menu in the users browser similar to cookies, only easier and much larger storage.

Each time the menu is accesses you could write a new storage string to save the data. When you return to the course, read the storqage and repopulate those variables.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Feb 05, 2020

Copy link to clipboard

Copied

This is a few years late but I am running in to the same issue. I do not understand the response as it was given to this question. Can this be drilled out to layman's terms please? 

 

Question: is there a way to save the progress as the user goes through the captivate file?  So if the user re-opens the Captivate file, the check marks will still be there that were made within the advanced action settings of the TOC?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Feb 05, 2020

Copy link to clipboard

Copied

You can use localStorage to store data in the user's browser, usually a default of 10MB. Note that the user can clear localStorage at any time just like cookies.

 

You would need to use JavaScript to write and retrieve the localStorage. You would need to implement Captivates event listeners to see if there is a value for localStorage when the project is launched. If there is a saved value, go to the page representing their progress. You cn also store the variable values you use the show the checkmarks or anything else you want to save.

 

You can learn about the listeners here:

https://helpx.adobe.com/captivate/using/common-js-interface.html

 

Here is an example I use, you would need to include this script in an external JavaScript file and put the include statement in the header of the index.html.

 

'use strict':

//array built from the totalSlides variable to keep track of visited slide and activate the next button
var myProgress = 0;
//test if running http
var netConnected = location.protocol.indexOf('http') !== -1 ? true : false;
//test if running http on localhost
var localHost = location.href.indexOf( 'localhost' );
//Captivate variables supplied in the template for the JS Interace API
var interfaceObj, eventEmitterObj;
//add event listener to the window to listen for Captivates moduleReadyEvent
//event is fired when Captivate has created the cp object and created the html
window.addEventListener( 'moduleReadyEvent', function ( e )
{
//internal objects and methods supplied by Captivate
interfaceObj = e.Data;
eventEmitterObj = interfaceObj.getEventEmitter();
//call function to initialze localStorage
initStorage();
});

//function to keep track of user's progress. Builds an array 0 = not completed, 1 = completed.
function initStorage()
{
//check if localStorage is enabled and running on a server
if ( typeof( Storage ) !== 'undefined' && netConnected !== -1 )
{
//check if the local storage exisits
if ( localStorage.getItem( myProgress ) !== null )
{
//load the local storage into the getResults variable
var getResults = localStorage.getItem( myProgress );
//convert the local storage back into an object and populate the array
myProgress = Number( getResults );

window.cpCmndGotoSlide = myProgress - 1;
window.cpCmndResume = 1;
}
}

//call the initializeEventListeners function
initializeEventListeners();
}

//function to set the localStorage in the browser
function setStorage()
{
//check if localStorage is enabled and running on a server
if ( typeof( Storage ) !== 'undefined' && netConnected !== -1 )
{
//write the local storage
localStorage.setItem( myProgress, window.cpInfoCurrentSlide - 1 );
}
}

//function to initialize all event listeners used
function initializeEventListeners()
{
//prevent error if does not exist
if ( interfaceObj )
{
//prevent error if does not exist
if ( eventEmitterObj )
{
eventEmitterObj.addEventListener( 'CPAPI_SLIDEENTER', function ( e )
{
setStorage();
});
}
}
}

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...