Renaming of Objects between version 7 and 9

Problem: I have many projects started in versions 6 and 7 with many lines of javascript that reference objects such as “Text Box_” and “Fill In Multiple Blanks Question_” that have changed in version 9 to “Text Entry_” and “Fill In Text Entries Question_”, is there a way to change the way the program refers to these objects rather than editing all my javascript.

ActivePresenter version: 9.0.7

OS: win 11

Notes:

Hi,

Since the version 6 and version 9 APIs are different, it is recommended to rewrite the script in this case.
With version 7 or later, please try the following workaround:

  • Open the ActivePresenter > Project > Properties pane.
  • In the Interactivity tab, in the On Load event, add an Execute JavaScript action.
  • Add the following code to the action:
if (prez.__inited)
    return;
prez.__inited = true;

var oldObjFunc = prez.object;
prez.object = function(objName) {
    var obj = oldObjFunc.call(this, objName);
    if (obj)
        return obj;
    if (objName.startsWith("Text Box_"))
        objName = objName.replace("Text Box_", "Text Entry_");
    else if (objName.startsWith("Fill In Multiple Blanks Question_"))
        objName = objName.replace("Fill In Multiple Blanks Question_", "Fill In Text Entries Question_");
    else
        return obj;
    return oldObjFunc.call(this, objName);
}

Regards,

1 Like

I’ll give it a try, many thanks for your help.