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

After effects scripting

Explorer ,
Jul 08, 2023 Jul 08, 2023

Hello

I have this simple code to create ui docable panel for after effects and i want to click the button and colse panel but it isn't working, any help? :

function createDockableUI(thisObj) {
var dialog = thisObj instanceof Panel ? thisObj : new Window("window", undefined, undefined, { resizable: true });
dialog.onResizing = dialog.onResize = function() { this.layout.resize(); };
return dialog;
}

function showWindow(myWindow) {
if (myWindow instanceof Window) { myWindow.center(); myWindow.show(); }
if (myWindow instanceof Panel) { myWindow.layout.layout(true); myWindow.layout.resize(); }
}

var win = createDockableUI(this);
var button1 = win.add("button", undefined, "TestMe");
button1.onClick = function() { win.close(); };
showWindow(win);

 

TOPICS
FAQ , Scripting
236
Translate
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
Enthusiast ,
Jul 08, 2023 Jul 08, 2023

I believe you can only close a window, not a docked panel. The script doesn't create the panel, it's given it by AE (which is what you pass in with 'this') so it makes sense that it wouldn't have control over closing it. If you run the script from File > Scripts > Run Script File then it's created as a window and it does close.

Translate
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
Explorer ,
Jul 09, 2023 Jul 09, 2023
LATEST

I've created my script, for the first time when it is run, it will show a login form with an OK and Cancel button. If the user chooses to hit the Cancel button, I want to close both the login form and the main script panel. That's why I want to close it.

Translate
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