Using Variables in Captivate 4: A Simple Page Counter
Posted on 07. Oct, 2009 by captivatehero in Captivate 4, Tutorials
Hello fellow Captivaters!
This week I’m going to create a simple page counter using Captivate 4 variables that will keep track of the current slide that you are on and the total number of slides in your presentation. (Example: Slide 3 of 20) This is a straightforward way of letting your audience members track their progress, and is especially helpful is you decide to ditch Captivate’s Skin for your own custom navigation controls.
In prior versions of Captivate I created a Flash movie that would grab the existing slide variables with ActionScript 2.0 code and display them in an imported SWF. This was always a big hit in Captivate classes, but anyone who was not inclined to program was a little put off. Well no worries about code anymore. All you will need to pull this off is just a Text Caption and few clicks. Let’s get Captivating!
- On the Captivate opening screen under the Create Project column select Blank Project.

Select Blank Project.
- The New Project dialog box appears. From the drop down list on the right choose 790 x 545 Browser.

Choose 790 x 545 in the New Project dialog box.
- Click the OK button.
- A new untitled CP file is created. Save your work as SlideCounter.cp
- Add three blank slides by selecting Insert > Blank Slide three times. This will take you to the Edit View automatically.

Create three Blank Slides.
- Select Slide 1 in your Filmstrip.
- Choose Insert > Standard Objects > Text Caption…

Insert a Text Caption.
- The New Text Caption dialog box appears.
- Set up some simple Text Caption Properties
- Caption type: [transparent]
- Font: Arial
- Size: 14
- Type the word “Slide” in the Caption editor.

Select the Insert Variable button.
- Click on the Insert Variable button. The insert variable dialog box appears.
- Select System for the variable type.
- View by Movie Information.
- From the Variable list choose cpInfoCurrentSlide.

Select the cpInfoCurrentSlide variable.
- Click the OK button.
- Type in the word “of” right after the inserted variable.

This is what your text should look like.
- Click on the Insert Variable button again. The insert variable dialog box appears.
- Select System for the variable type.
- View by Movie Information.
- From the Variable list choose rdInfoSlideCount. You now have the variable in place. When these variables render they will display “Slide 1 of 4”. The first variable will resolve the current slide that you are on and the second will keep track of the total number of slides.

Select the rdInfoSlideCount variable.
- Click the OK button in the Insert Variable dialog box to close out.

Text Caption with variables added.
- Now it’s time to set up an object attribute to make sure that we can see our Simple Page Counter on all slides.
- With the New Text Caption dialog box still open click the Options Tab.
- In the Timing section – change the Display for: value to Rest of Project. This will allow the Page Counter to be visible on all slides.

Display the Text Caption for "Rest of Project".
- Click the OK button.
- Preview your example by hitting the F4 key.
You should now see your page counter read 1 of 3, 2 of 3, and 3 of 3 as it progresses through the slides.

This is the final variable text rendered in the caption.
If you see these results – well done!
Sample File (520K)
Now that’s real Captivate variable power.





















Elissa
08. Oct, 2009
I am workingn on a Captivate 4 project that has image buttons for previous (on success: go to previous slide and next slides (on success: go to next slide).
When I add these system variables for page counting and preview and/or publish the project, the system variable itself ($$cpInfoCurrentSlide$$ of $$rdinfoSlideCount$$) is visible when the previous or next button is clicked.
When I replace the buttons with the widget for the perpetual button, the problem resolves. However, our corporate template uses the previous and next buttons.
Any thoughts?
captivatehero
08. Oct, 2009
Elissa-
As long as you put these variables inside of a text caption they should resolve and a number should display. There is no relationship between how a user navigates between slides and the function of the these variables in Captivate. Very strange indeed.
You can e-mail me at hero@captaincaptivate.com if you are still having problems.
The Captain
Nick
26. Oct, 2009
I am having the same issue as Elissa above. When using the variable the code will briefly flash when clicking on the previous or next button that has been inserted onto the slide. When the buttons are removed however the page numbers transition perfectly, its only when the inserted buttons are on the page that this occurs. Like Elissa my company uses the Previous and Next buttons in this current project and removing them isnt an option. These variables are all inserted within a text caption and yet the problem still persists.
Any addtional thoughts on this subject? Thanks!
captivatehero
29. Oct, 2009
Nick-
I have seen this problem too. I think there’s a slight delay with the variable rendering on the slide.
It should be quick, but it’s not.
You could try turning the transition off of the object. Also, display it for rest of project.
I think that this is just a deficiency with Captivate and hopefully they fix it in the next version.
The Captain