• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Reload Script Panel

Participant ,
Apr 16, 2020 Apr 16, 2020

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.

TOPICS
How to , Scripting

Views

1.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 17, 2020 Apr 17, 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.

Votes

Translate

Translate
Community Expert ,
Apr 17, 2020 Apr 17, 2020

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 17, 2020 Apr 17, 2020

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 16, 2020 Jun 16, 2020

Copy link to clipboard

Copied

LATEST

Finally found the time to implement the refresh button, works great!

 

Corvin0_0-1592297670747.png

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines