Copy link to clipboard
Copied
Hi all!
This may be a RTFM question, but I can´t find the correct way to use this function.
I made a script (copied below) and when I install it as Install ScriptUI Panel the result is 2 windows, as seen attached, one docable and one not. What am I doing wrong if I want to have only 1 window (the dockable one with the button inside it)
SCRIPT:
var panelRender = this;
var renderWindow = new Window("palette", "Tool", undefined);
var panelRender = renderWindow.add("panel", undefined, "QUEUE");
panelRender.orientation = "row";
var renderButton = panelRender.add("button", undefined, "OPEN APP");
renderButton.onClick = function() {
$.evalFile(File($.fileName).path + '/Tool_v001.jsx')
}
renderWindow.center();
renderWindow.show();
Thanks very much!
Nacho
Typically I'd do something like this. You need to check if AE is giving the script a panel (i.e. this) or not then either add to that panel or create a new window if it isn't running as a panel.
function main(thisObj) {
var renderWindow;
if (thisObj instanceof Panel) renderWindow = thisObj;
else renderWindow = new Window("palette", "Tool", undefined, {resizeable:true});
// could also write it as
//var renderWindow = (thisObj instanceof Panel) ? thisObj : new Window("palette", "Tool", und
...
Copy link to clipboard
Copied
Typically I'd do something like this. You need to check if AE is giving the script a panel (i.e. this) or not then either add to that panel or create a new window if it isn't running as a panel.
function main(thisObj) {
var renderWindow;
if (thisObj instanceof Panel) renderWindow = thisObj;
else renderWindow = new Window("palette", "Tool", undefined, {resizeable:true});
// could also write it as
//var renderWindow = (thisObj instanceof Panel) ? thisObj : new Window("palette", "Tool", undefined, {resizeable:true});
var panelRender = renderWindow.add("panel", undefined, "QUEUE");
panelRender.orientation = "row";
var renderButton = panelRender.add("button", undefined, "OPEN APP");
renderButton.onClick = function() {
$.evalFile(File($.fileName).path + '/Tool_v001.jsx')
}
if (renderWindow instanceof Window) {
renderWindow.center();
renderWindow.show();
} else {
renderWindow.layout.layout(true);
}
}
main(this);
Copy link to clipboard
Copied
Worked awesomely! Thanks!