-
Scripting: Create new comp and open it
Hi,
At first i have to say that im pretty new in scripting. Im trying to create a very simple script that makes a new 1080 composition but i want to open the comp after, how can i archieve this?
I have one more question, hope you can help me..
When I throw the script, as I can make the edittext field stay in focus to write directly and when pressing the return key the onclick event takes place?
Thanks!
var proj = app.project;
var undoStr = "Crear Nueva Composición 1080p";if (proj){
var myComp = app.project.items;app.beginUndoGroup(undoStr);
win=new Window("palette","Crear nueva Composición",undefined,{resizeable:false,});
panel_1=win.add("panel",[5,5,285,149]);
panel_1.graphics.backgroundColor = panel_1.graphics.newBrush (panel_1.graphics.BrushType.SOLID_COLOR,[0.51,0.51,0.51]);
but_1=panel_1.add("button",[70,97,210,123],"Aceptar");
edittext_1=panel_1.add("edittext",[40,50,240,78] ,"",{readonly:0,noecho:0,borderless:0,multiline:0,enterKeySignalsOnChange:0});
edittext_1.graphics.foregroundColor = edittext_1.graphics.newPen (edittext_1.graphics.PenType.SOLID_COLOR,[0,0,0], 1);
edittext_1.graphics.backgroundColor = edittext_1.graphics.newBrush (edittext_1.graphics.BrushType.SOLID_COLOR,[0.73,0.85,0.87]);
statictext_1=panel_1.add("statictext",[69,22,330,42] ,"Nombre de la Composicion",{multiline:true});
statictext_1.graphics.foregroundColor = statictext_1.graphics.newPen (statictext_1.graphics.PenType.SOLID_COLOR,[0,0,0], 1);
win.center();
win.show();but_1.onClick = function ()
{
if (edittext_1.text=="")
{
alert("Debes de escribir un nombre para la composicion");
} else {
myComp.addComp(edittext_1.text, 1920, 1080, 1, 15, 25);
win.close();
}
}app.endUndoGroup();
}
else
{
alert("Please create a project before");
}