How to get value of variable and variable custom on Javascript


Problem: I need to get value of variable and variable custom on javascript in other slide.

ActivePresenter version: 8.2.1

OS: Windows 10


Best regard

Hi Nathanael,

A variable in ActivePresenter is accessible from any slide. You can use the following JavaScript API to get and set a variable:

// get variable value
var value = prez.variable('variable name');
// set variable value
prez.variable('variable name', newValue);

If you mean the variable in your JavaScript code, you can assign it to the presentation object to access in other slides:

// set your variable in a slide
// (please make sure that your variable don't overwrite any existing properties of prez object,
// e.g you can set a prefix for your variable name)
prez.myVariableA = value;
// in another slide
if (prez.myVariableA == value1)