Skip to main content
Corvinus Corax
Inspiring
April 16, 2020
Answered

Reload Script Panel

  • April 16, 2020
  • 1 reply
  • 2647 views

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.

This topic has been closed for replies.
Correct answer Justin Taylor-Hyper Brew

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.

1 reply

Justin Taylor-Hyper Brew
Community Expert
Community Expert
April 18, 2020

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.

Corvinus Corax
Inspiring
April 18, 2020

Good Point, I'll try that, thanks. Sometimes its the simplest things 😉

Corvinus Corax
Inspiring
June 16, 2020

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 ();