从After Effects中的CEP扩展打开CEP对话框



我在After Effects中有一个CEP扩展,我希望它能在用户单击按钮时,在一个新的浮动对话框中打开一个设置对话框。这似乎是一个基本的功能,但不知何故,我在(公认的稀疏(文档中没有看到如何打开对话框。我看到其他一些人说,你可以制作一个隐藏的扩展来打开对话框,但我没有看到任何例子,也不清楚这对我来说是如何工作的。

您可以查找ScriptUI的文档。以下是pdf的链接:https://adobeindd.com/view/publications/a0207571-ff5b-4bbf-a540-07079bd21d75/92ra/publication-web-resources/pdf/scriptui-2-16-j.pdf

您可以在jsx中的一个函数中创建一个对话框,也可以给它自己的jsx页面和//@include it onclick。

我知道这是一个通用的答案,但如果其他人有麻烦,这会给你一个很好的起点。

因此,为了提供所需的功能,您必须首先初始化一个对话框,然后添加一个按钮,然后强制它打开一个特定的设置对话框。我推荐这样的东西:

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.");
}

必须找到要打开的CEP对话框的直接路径。我不熟悉它们以及它们与After Effects的集成,所以除了设置脚本之外,我帮不了你太多。然而,我对这里可能也有帮助的资源有一些看法。

PeterKahrel的ScriptUI资源非常棒。在过去的几周里,我一直在使用它。我想在Jake L所说的基础上再加上一些扩展脚本支持的好例子,因为你必须挖掘文档,但它肯定存在。

https://extendscript.docsforadobe.dev/

我最近偶然发现了Extendescript库,但它详细介绍了许多函数,深入研究了事件和事件处理程序,甚至解释了如何通过vscode为Extendescript设置环境。

我还想在youtube上查看NTProductions以寻求帮助。我在Indesign工作,但许多extendscript函数在各种adobe程序之间工作,您甚至可以在adobeextendscriptToolkit中对基本函数进行故障排除。

如果您已经拥有Adobe CC帐户,请不要忘记从Adobe API和服务下载Scripting SDK。你必须登录才能到达那里,但这是一份非常有用的本地文档。

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

编辑(再次(:我在发布后也发现了这些,并将承诺在找到它们时添加更多。扩展脚本文档必须变得更加可用!:-(

https://docsforadobe.dev/

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

最新更新