How does one get the total number of slides?

In Articulate's Storyline product, how does one retrieve the total number of slides (or pages) in a storyfile or project?

There's not much documentation so it's kind of hard to figure out how to query common environment values like this. If we can get the total number of slides then we don't have to manually set a value for it.

I posted this question on stack overflow here:


25 Replies
Michael VanDusen

First post here.

After plenty of reverse engineering and debugging, you can find the total number of slides viewable in a story.

If you are comfortable with a little custom JavaScript coding for a trigger:

var player = GetPlayer();
player.totalViewSlides; // this return the number you want

player.GetVar("totalViewSlides") // this returns 0 - don't use

The player runs the player.calculateTotalViewSlides method which loops through and increments the player.totalViewSlides variable. As long as the player has time to build, player.totalViewSlides is calculated and exposed.

You could set a global variable through the Triggers panel / Manage project variable button:

totalNumSlides / number / 0

Then set it with a custom JavaScript trigger:

var player = GetPlayer();
var totalNumSlides = player.totalViewSlides;
player.SetVar("totalNumSlides", totalNumSlides);

Now you can use totalNumSlides as needed.

Hopefully this helps someone.

Ashley Terwilliger-Pollard

Hi Michael,

Welcome to the community! I love that this type of detail and help is your first post! Hope we'll be seeing more of you around. 

Not knowing entirely how you're using this set up, I did want to point out there is an easy way to find out the total number of slides just as a basic number. If you look at publishing to LMS, one of the tracking options is by slides viewed and you'll be able to choose out of the total number of slides as you see in this screenshot. Now that's super basic - and if you're doing some more custom display based on what slide the user is viewing at that time out of X number of slides - Javascript is definitely the way to go! 

Thanks again for sharing - and feel free to let us know if you need anything else. 

Ashley Terwilliger-Pollard

Hi Nathan, 

I'm not sure if Michael is still subscribed here, as the post is a bit older - but you could always use the "contact me" button on a ELH users' profile to reach out to them directly!

Let me know if there is anything I can help with (outside of the Javascript - as we don't offer support for it)! 

Crystal Horn

Hi Guru!  Do you need to show your learners a slide counter, or do you need to figure out how many slides you have authored?  This discussion provides a user-created solution for displaying slide counts for users. 

We're tracking requests for automatic slide numbering as well, so thank you for contributing!

Raja Guru

Hi Crystal,

Have a good day!

Thanks for reply. Actually I tried to show page numbers at the bottom of the content area like 1 2 3.... So that the user can click on the page numbers and will jump from page to page at any time. So, it should be a global declaration in the master slide or in the html page using JS. But, I'm unable to get the total number of slides as well as jump to the user selected page. Is there any way to get it? and also can I jump to a particular page using JS? 

Note: Some one suggested that declare a global variable and enter the total number of pages manually in it. That's fine but, need to change it at all time if add or remove slides. Every time I should be remember to change it. If I get it globally as soon as opened the app, it would be very nice to place the numbers at the bottom of the page dynamically :).

Please suggest.


Ashley Terwilliger-Pollard

Hi Guru, 

Setting up that jump to slide based on a Javascript set up is something I'll have to rely on the community to help with! It's not something we can support, but there are lots of folks here in the community who have set up similar.

Can you share a copy of your .story file here so that folks can take a look at what you have already got set up?

Raja Guru

Hi Ashley,

Thank you very much. 

I found some logic to jump to the target page, but it will be jumping page by page and reach the targeted page. Seems it's very slow as I have some images and videos in many page. So, if any one suggest easy way to jump directly to the particular page, it would be nice. Kindly help.