ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Script to pull in a local image to project panel keeps forcing new project - I'd like to import to current project

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
David Hawkins
Script to pull in a local image to project panel keeps forcing new project - I'd like to import to current project
on Mar 6, 2018 at 12:18:28 pm

Hey guys,

Script newbie here and would appreciate any help.

The current script - which was previously used in Photoshop by someone else - imports a downloaded image (location) to the project panel.

function OpenDocument(location) {
return app.open(new File(location));
}


Right now a selected image is downloaded via a panel (Pixabay image API). It downloads fine and then is immediately seen in the project panel, but either a new untitled project has been created automatically (if current project is saved), or I get the "Save changes to 'untitled project' before closing?" prompt.

Any ideas would be greatly appreciated. I'll be honest, I don't completely understand what the code is doing - just hunches. I simply want the downloaded image to appear in the project panel of current project - no questions asked.


Return to posts index

Dan Ebberts
Re: Script to pull in a local image to project panel keeps forcing new project - I'd like to import to current project
on Mar 6, 2018 at 5:05:50 pm

Something like this, probably:

var myFilePath = "/c/test/test.png";
var myImportOptions = new ImportOptions();
var myFile = File(myFilePath);
myImportOptions.file = myFile;
app.project.importFile(myImportOptions);


Dan



Return to posts index

David Hawkins
Re: Script to pull in a local image to project panel keeps forcing new project - I'd like to import to current project
on Mar 6, 2018 at 7:40:40 pm

Hi Dan, I'm grateful for your reply. As novice as I am with scripts, your forum posts and website in particular have helped me immensely over the years, you have no idea. This year I've put it upon myself to no longer be strictly a copy/paste user of scripts. :p

Thanks!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]