skip to Main Content

I have a CEP extension in After Effects and I want it so that when a user clicks a button, a settings dialog opens up in a new floating dialog box. Seems like it would be such basic functionality but somehow I’m not seeing anywhere in the (admittedly sparse) documentation how to open up a dialog box. I’ve seen some other people say that you can make a hidden extension which opens the dialog, but I’ve seen no example of that and it is unclear how that would work to me.

2

Answers


  1. You can look up documentation for ScriptUI. Heres a link to the pdf: https://adobeindd.com/view/publications/a0207571-ff5b-4bbf-a540-07079bd21d75/92ra/publication-web-resources/pdf/scriptui-2-16-j.pdf

    You can create a dialog either in a function in the jsx, or give it its own jsx page and //@include it onclick.

    I know this is kind of a generic answer, but incase anyone else is having trouble this will give you a good jumping off point.

    Login or Signup to reply.
  2. So in order to provide the functionality you need, you’ll have to initialize a dialog box first, then add a button, then force it to open a specific settings dialog. I recommend something like this:

    var dialog = new Window("dialog");
                   dialog.text = "After Effects Dialog Script";
    
    //Contents
            var newMsg = dialog.add("group", undefined, {name: "newMsg"});
                   newMsg.orientation = "column";
            var newMsgText = newMsg.add("statictext", [0, 0, 400, 40], "", {name: "newMsgText", multiline: true});
                   newMsgText.text = "Would you like to open a settings dialog?";
            
    //Button UI        
            var buttonPanel = dialog.add("group", undefined, {name: "buttonPanel"});
                      buttonPanel.orientation = "row";
                      buttonPanel.alignChildren = ["center", "bottom"];
            var enter = buttonPanel.add("button", undefined, undefined, {name: "ok"}); 
                      enter.text = "Continue";
                      enter.value = true; 
            var cancel = buttonPanel.add("button", undefined, undefined, {name: "cancel"}); 
                      cancel.text = "Cancel";
                      cancel.value = false; 
    
    //Runs the dialog code
    dialog.show();
    
    //Grabs answer to yes or no question
    var dialogInput = dialog.show();        
            if(dialogInput == true){
                app.openDlg (prompt, filter, multiSelect);  //Essentially 
                }
                else {
                    alert("The action was canceled.");
                                }
    

    You will have to find the direct path to the CEP dialog you wish to open. I’m unfamiliar with them and their integrations to After Effects, so I can’t help you much beyond getting the script set up. However I have a few comments on resources that may be of assistance here too.

    That ScriptUI resource by Peter Kahrel is fantastic. I’ve been working with it for the last few weeks. I wanted to add on to what Jake L said by dropping in a few more great examples of Extendscript Support because you kinda have to dig for the documentation, but it’s definitely there.

    https://extendscript.docsforadobe.dev/

    I just stumbled upon the Extendscript Library recently, but it details a lot of functions, dives deep into events and event handlers, and even explains how you can set up an environment for extendscript via vscode.

    I also like to check out NTProductions on youtube for assistance. I’m working in Indesign, but a lot of the extendscript functions work between the various adobe programs and you can even troubleshoot basic functions in the Adobe ExtendScript Toolkit.

    And if you already have an Adobe CC account, don’t forget to download the Scripting SDK from adobe APIs and Services. You’ll have to sign in to get there, but it’s a pretty useful local documentation.

    https://developer.adobe.com/console/servicesandapis/id#

    EDIT (again): I also found these after posting and will commit to adding more as I find them. Extendscript documentation must become more available! 🙂

    https://docsforadobe.dev/

    http://yearbook.github.io/esdocs/#/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search