SlideNames in Javascript

Problem: Is there a way in Javascript to get the name of the current slide similar to ‘currentSlideIndex()’?



ActivePresenter Version: 8

OS: win10


Hi Rolf,

In the current version, slide name has HTML format, it’s not plain text as object name.
So it should be used only for showing (not storing, comparing … in JavaScript), and you can use apCurrentSlideLabel variable for this purpose.


Thanks, Toan,

so just to be clear. I cannot have a JS code in the master where I do something like

if(apCurrentSlideLabel == ‘Hello’) {…}

Best, Rolf

Yes, you should not use JS code like that.
prez.variable('apCurrentSlideLabel') will return something like "<p style=\"margin-top: 0px; margin-bottom: 0px; \">Hello</p>

You can assign a name for a slide in its On Load event and check this name in other events. For example:

// in a slide On Load
prez.myCurrentSlideName = 'Hello';
// in that slide On UnLoad: reset current slide name
delete prez.myCurrentSlideName;

// in another event
if (prez.myCurrentSlideName == 'Hello') {...}


Thanks, Toan, that’s really helpful.