Page 1 of 1
import comp
Posted: June 15th, 2007, 8:22 am
by zantek
Hi
I want to make a palette with several buttons, which can let me open definied projects, and other useful scripts.
How to import a specific comp (ie : an exisiting myComp.aep) with script?
thks
Posted: June 15th, 2007, 3:48 pm
by nab
Hi Zantek,
you can't import a comp, a composition is not a file.
To import a single file (without safe options), put something like this in your click event function (see the smartImport.jsx demo script for more details)
Code: Select all
function OnImportBtnClicked()
{
app.project.importFile(new ImportOptions(theFile));
}
To execute a script from the palette, look at the DemoPalette script that comes with AE.
Posted: June 15th, 2007, 3:59 pm
by zantek
thanks.
After few searches i found this:
Code: Select all
function openComp()
{
var my_file = new File(".../thePathTo/MyComp.aep");
if (my_file.exists){
new_project = app.open(my_file);
if (new_project){
alert(new_project.file.name);
}
}}
so it loads my new project.
I'd like to add a "if" in case of MyCompo.aep is still opened, so it asks the user to save (under a new name for example or something else) before open MyComp.aep .