Welcome to the in5 Answer Exchange! This a place to get answers about in5 (InDesign to HTML5) and make requests.
0 votes

The below works if running a script, but is there a way to run it via a button?

var doc = app.activeDocument;
 
for (var i = 0; i < doc.pages.length; i++) {
var page = doc.pages[i];
page.select();
 
var multiState = page.multiStateObjects.itemByName("Multi-state-1");
 
multiState.activeStateIndex++;
 
}
in how_to by (120 points)
  

1 Answer

0 votes

You can trigger JavaScript from InDesign using a new Hyperlink that you can apply to a shape as your button. Here's more information:

by (28.5k points)
Thanks Myra. I tried placing the JavaScript itself into the button, like your linked example, but it doesn't work. Is it recommended to run a separate .js file? If so where should that be located to work for an exported fixed format epub?

You'll need in5 in order to try the approach from the article. in5 exports content as HTML5 but not as a fixed layout epub:

You can download the in5 trial here:

but be aware there are limitations in demo mode:

When you export with in5, add the JavaScript in the Resources section of the in5 export dialog.