Skip to main content
zachneel
Participating Frequently
October 14, 2017
Answered

ScriptUI Blank Panel Error

  • October 14, 2017
  • 1 reply
  • 2756 views

So I have this script I'm writing:

var w=new Window ('palette');

var panelGroup=w.add("Panel",undefined,"Name");

panelGroup.alignChildren="left";

var scaleCheck=panelGroup.add("checkbox",undefined,"Scale");

var rotateCheck=panelGroup.add("checkbox",undefined,"Rotation");

var opacityCheck=panelGroup.add("checkbox",undefined,"Opacity");

var colorCheck=panelGroup.add("checkbox",undefined,"Color");

var customCheck=panelGroup.add("checkbox",undefined,"Custom");

var applyButton=w.add("button",undefined,"Apply");

w.layout.layout(false);

w.center();

w.show();

I'm new to scripting, but basically I'm trying to create a simple UI with checkboxes with different properties applied. Whenever I run it through ESTK it looks perfect. But when I run through the ScriptUI Panels folder from the "window" tab in AE it does this:

Essentially creating a huge dockable blank panel, and my smaller panel that is still undockable. Any help is appreciated!

This topic has been closed for replies.
Correct answer Tomas Sinkunas

This snippet takes care of if:

(function (thisObj) {

    buildUI(thisObj);

    function buildUI(thisObj) {

        var win = (thisObj instanceof Panel) ? thisObj : new Window("palette", "script", undefined, {

            resizeable: true

        });

        var panelGroup = win.add("Panel", undefined, "Name");

        panelGroup.alignChildren = "left";

        var scaleCheck = panelGroup.add("checkbox", undefined, "Scale");

        var rotateCheck = panelGroup.add("checkbox", undefined, "Rotation");

        var opacityCheck = panelGroup.add("checkbox", undefined, "Opacity");

        var colorCheck = panelGroup.add("checkbox", undefined, "Color");

        var customCheck = panelGroup.add("checkbox", undefined, "Custom");

        var applyButton = win.add("button", undefined, "Apply");

        win.onResizing = win.onResize = function () {

            this.layout.resize();

        };

        if (win instanceof Window) {

            win.center();

            win.show();

        } else {

            win.layout.layout(true);

            win.layout.resize();

        }

    }

})(this);

1 reply

Tomas Sinkunas
Tomas SinkunasCorrect answer
Legend
October 14, 2017

This snippet takes care of if:

(function (thisObj) {

    buildUI(thisObj);

    function buildUI(thisObj) {

        var win = (thisObj instanceof Panel) ? thisObj : new Window("palette", "script", undefined, {

            resizeable: true

        });

        var panelGroup = win.add("Panel", undefined, "Name");

        panelGroup.alignChildren = "left";

        var scaleCheck = panelGroup.add("checkbox", undefined, "Scale");

        var rotateCheck = panelGroup.add("checkbox", undefined, "Rotation");

        var opacityCheck = panelGroup.add("checkbox", undefined, "Opacity");

        var colorCheck = panelGroup.add("checkbox", undefined, "Color");

        var customCheck = panelGroup.add("checkbox", undefined, "Custom");

        var applyButton = win.add("button", undefined, "Apply");

        win.onResizing = win.onResize = function () {

            this.layout.resize();

        };

        if (win instanceof Window) {

            win.center();

            win.show();

        } else {

            win.layout.layout(true);

            win.layout.resize();

        }

    }

})(this);

zachneel
zachneelAuthor
Participating Frequently
October 14, 2017

Thanks!! Any chance you could explain to me what exactly is going on here? And why I was getting that error?

and also: if I wanted to use the checkbox values elsewhere how would so pull that

Tomas Sinkunas
Legend
October 15, 2017

David Torno has fantastic series on Extendscript. Couldn't recommend it enough https://www.provideocoalition.com/after-effects-extendscript-training-complete-series/