• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Dynamically create chapters based on slidelabels

Explorer ,
Jun 22, 2022 Jun 22, 2022

Copy link to clipboard

Copied

Hi.

 

I want to create "chapters" for a course. The user can choose the chapter from a main menu and I have custom navigation. I need an indicator to show when a chapter is completed, that will change the chapter-button on the main page. The number of slides for each chapter is yet unknown, so I wanted to make it a bit generic. I will have all the slide labels in a chapter cointain the same word (eyes, nose, mouth, etc. (It's a course about facial comparison)). I thought I could loop through and get check the slide label of each slide at startup, and generate a MAP with [slideNumber, slideState (a custom variable)].

 

I have tried

var getSlides = cp.model.data.project_main.slides.split(",");

I believed getSlides would be an array with all the slides in it, and getSlides.lenght; returns the correct ammount if slides. Yet I am unable to figure out how to access the slide label/slideName/lb. 

 

I have also tried to find out if rouped slides in Captivate end up in an array somewhere. But have been unable to find any documentation.

 

Can anyone point me towards a solution?

Kind regards 🙂

TOPICS
Advanced

Views

64

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
community guidelines

correct answers 1 Correct answer

Contributor , Jun 22, 2022 Jun 22, 2022

Using your getSlides array from the code you provides...you can easily get each of the slide lables by using the following code: cp.D[getSlides[n]].lb  Where n is the number of the slide id number in your getSlides array. So if you had written the line as cp.D[getSlides[0]].lb it would give you the slide lable for your very first slide!

 

Example:

var getSlides = cp.model.data.project_main.slides.split(",");  // getSlides array data [ "Slide13732", "Slide15046", "Slide15902" ]

var slideOneLabel = cp

...

Likes

Translate

Translate
Community Expert ,
Jun 22, 2022 Jun 22, 2022

Copy link to clipboard

Copied

Does it need to be so complicated? Why not use the TOC in Captivate? If you group slides per chapter, the group name will appear at the highest level in the TOC, and the slides will be at the second level. Visited slides can get a checkmark, navigation is possible by TOC. Slide labels are visible in the TOC.

You didn't specify if the custom navigation allows free visiting slides in any sequence or if you expect a forced navigation within a chapter? Do you use a custom 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
community guidelines
Contributor ,
Jun 22, 2022 Jun 22, 2022

Copy link to clipboard

Copied

Using your getSlides array from the code you provides...you can easily get each of the slide lables by using the following code: cp.D[getSlides[n]].lb  Where n is the number of the slide id number in your getSlides array. So if you had written the line as cp.D[getSlides[0]].lb it would give you the slide lable for your very first slide!

 

Example:

var getSlides = cp.model.data.project_main.slides.split(",");  // getSlides array data [ "Slide13732", "Slide15046", "Slide15902" ]

var slideOneLabel = cp.D[getSlides[0]].lb  // slideOneLabel in my case would hold the value of  "Title Slide"

var slideLabelNamesArray = []; // Create an array to store your slide labels in order
var getSlides = cp.model.data.project_main.slides.split(","); // get current project slide object IDs

// This loop will store all of the slide labels in the slideLabelNamesArray
for(var i=0; i < getSlides.length; i++) {
    slideLabelNamesArray[i] = cp.D[getSlides[i]].lb
}

/* View all of the slide labels in your browsers console log
    in the form of a table. When looking at the generated table
    Think of the (index) column as the slide number..where
    0 is slide one, 1 is slide 2, etc... The Values area
    will show each coresponding slide label */

console.table(slideLabelNamesArray);

 

 

    That was just a quick and basic example to go with your orginal quesiton and code......

 

 

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
community guidelines
Explorer ,
Jun 22, 2022 Jun 22, 2022

Copy link to clipboard

Copied

Thank you Lover&Hacker!

 

Worked like a charm. I'm getting the slide labels now 🙂

I feel a bit like I'm stumbling in the dark, looking for undocumented variables and functions.

 

As to using the Captivate TOC, Lilybiri ... I'll give it a try. I'll have to restrict access to the cahpters only, because there wil lbe too many slides. I have previously discarded the idea, since I'm not a fan of the design of it.

 

Thank you both and have a nice summer 🙂

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
community guidelines
Community Expert ,
Jun 23, 2022 Jun 23, 2022

Copy link to clipboard

Copied

LATEST

You can also create a custom TOC, which you allow to pop up on each slide.

When using a TOC in a long course, I tend to collapse all the chapters, show the learner how to expand a chapter for navigation. 

Of course, JS allows a lot more of control and we have a lot of JS experts around here willing to help you. However, although I do use JS I tend to use Captivate's features whenever possible. Due to my long presence here and elsewhere in forums I realize that many developers simply are not aware of some features.

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
community guidelines