Update: I was wrong, goToSlide() does work. Turns out there are two versions of this function with the exact same name. The version that takes two mystery arguments is generated for internal use when you add a “Go to slide” action. The version that exists as a cpAPIInterface method is a completely different function that takes only one argument, which I eventually figured out is a slide label. And it works! For example, calling cpAPIInterface.goToSlide("Comparison 3") will immediately load that slide.
But what if you need to jump around by slide number instead? Simple, just extract the project’s TOC metadata at runtime and build an array of all the slide labels:
var toc = JSON.parse(cp.model.data.tocProperties.tocProperties).tocConfig.slideDetails;
var slideLabels = [];
for (var rec of toc) {
slideLabels.push(rec.label);
}
I did notice that each record in the TOC has an “isVisible” property. I have no idea under what conditions a slide might become not-visible, nor if that would affect slide indexing, but it might be something you’d have to account for depending on what you’re doing.
Anyway, with the label array built, jumping by slide number can be done like so:
cpAPIInterface.goToSlide(slideLabels[destSlide - 1]);
The - 1 because Captivate slide numbering is 1-based rather than 0-based. Or you could get rid of the subtraction by initializing the labels array to [""] instead of [] so the 0 slot would be unused.
Now everybody start using this so Adobe can’t remove it.