import comp

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
zantek
Posts: 4
Joined: June 15th, 2007, 7:49 am

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
nab
Posts: 203
Joined: November 29th, 2005, 3:00 am
Location: Royan
Contact:

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.
zantek
Posts: 4
Joined: June 15th, 2007, 7:49 am

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 .
Post Reply