-
Ae script import, search, then add to active comp
So i’m trying to make a script that importing a .aep file, then add the comp file from .aep imported before to the active comp .
I’m sorry for being so stupid but, i can’t get this to work .
Here’s the scriptfunction CALL (){
app.beginUndoGroup("Template");
var ListTxt = List.selection.text ;
var ScriptFile = new File($.fileName);
var Path = ScriptFile.path + "/Folder/" + ListTxt +".aep";
var ImportOptions = new ImportOptions(File(Path));
var proj = app.project;
proj.importFile(ImportOptions);
var ICompCheck = rnPanel.grp.rnG.rnTabbedPanel.rnCMT.ImComp;
if (ICompCheck.value){
var Comp = app.project.activeItem;
for(var i = 1; i <= app.project.numItems; i++) {
if (app.project.item(i) instanceof CompItem){
var CleanOne = i.duplicate();
Comp.layers.add(CleanOne);
}
}
}
}
app.endUndoGroup;