Copy link to clipboard
Copied
Is there a way to force an extendScript Panel to reload (on a e.g. a button click)? I dont mean to rebuild its UI with the layout manager, but something similar to closing the panel and starting it anew from Window/myPanel.jsxbin.
Why I want to do this: I've got template projects that are controlled with specific UI panels. To ensure that the opened project works with one specific panel, I have an empty comp named "DOCKABLE_ENABLED_MyTemplateName". The panels are looking for this comp-name and enable/disable their elements depending on whats found (or not).
mainPSGrp.enabled = false;
for (i = 1; i <= app.project.numItems; i++){
if ((app.project.item(i) instanceof CompItem) && (app.project.item(i).name == "DOCKABLE_ENABLED_Template_One")){
mainPSGrp.enabled = true;
}
}
The problem is, that if this panel is opened before loading the AET (with disabled controls) it won't enable them on load of the template. I have to manually close and reopen it again. And thats something I'd like to avoid.
You could just run the check function again when your panel is focused. Or you could add a refresh button that re-runs the check.
Copy link to clipboard
Copied
You could just run the check function again when your panel is focused. Or you could add a refresh button that re-runs the check.
Copy link to clipboard
Copied
Good Point, I'll try that, thanks. Sometimes its the simplest things 😉
Copy link to clipboard
Copied
Finally found the time to implement the refresh button, works great!
var refreshButton = myRow2.add("button",undefined,'\u21BA');
refreshButton.onClick = function () {checkEnabled ();}
myRow1.enabled = false;
/******************************************************************
//////////////////// Check if opened AE Project is dockable ready ////////////////////
******************************************************************/
function checkEnabled () {
for (i = 1; i <= app.project.numItems; i++){
if ((app.project.item(i) instanceof CompItem) && (app.project.item(i).name == "DOCKABLE_ENABLED_PULS4")){
myRow1.enabled = true;
}
}
}
checkEnabled ();