ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Import a file + a couple more steps script

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Deanna Keogh
Import a file + a couple more steps script
on Jan 29, 2020 at 7:50:45 am

Hello,

Just after some help in scripting some automated workflow in after effects. (I've downloaded kbar and am making scriptlet buttons)
I'm learning how to do broader after effects scripting slowly but I don't really understand as much as I'd like.

Im after a script that:
1. Imports 2 files
2. Puts the files in the current selected comp
3. Make them a guide layer
4. Lock them both

I've currently only got step one down, which is simple stuff, and that was after a lot of googling.
I know I need to add some variables and something like var myComp = app.project.activeItem; etc.
Im just not sure of the order and finer details...
Any help would be greatly appreciated :)

newFootageItem = app.project.importFile(new ImportOptions(new File("filepath/FILE1.png")));
newFootageItem = app.project.importFile(new ImportOptions(new File("filepath/FILE2.png")));


Return to posts index

Andrei Popa
Re: Import a file + a couple more steps script
on Jan 29, 2020 at 8:17:12 am

Something like this maybe


newFootageItem = app.project.importFile(new ImportOptions(File.openDialog()));
newFootageItem1 = app.project.importFile(new ImportOptions(File.openDialog()));
myCrtComp = app.project.activeItem;
var layer1 = myCrtComp.layers.add(newFootageItem);
var layer2 = myCrtComp.layers.add(newFootageItem1);
layer1.guideLayer = true;
layer1.locked = true;
layer2.guideLayer = true;
layer2.locked = true;


Andrei
My Envato portfolio.


Return to posts index

Deanna Keogh
Re: Import a file + a couple more steps script
on Jan 30, 2020 at 3:30:09 am

Thank you so much! That worked perfectly!

The only issue I've noticed is that when I run the script, it imports, sets to guide layer and locks, but then if I delete them out of the project and try to run the script again it won't import them into the same comps as before and I get an error. I have to create a new comp and then I can run the script again, then this works. Do you have any idea why this is occurring?

Thanks so much for your help!


Return to posts index


Tomas Bumbulevičius
Re: Import a file + a couple more steps script
on Jan 30, 2020 at 3:37:05 pm

Deanna, for this script to work you need to have composition in After Effects opened, and active, before running a script.

Alternatively, if this does not help, please share error you are getting and someone will be definitely able to help you out.

Cheers!

Find out more:
After Effects Tutorials: motion design, expressions, scripting.
Boxer - Dynamic Text Boxes Template with a Live Preview


Return to posts index

Deanna Keogh
Re: Import a file + a couple more steps script
on Feb 5, 2020 at 1:08:26 am

You are completely right Tomas, thank you. I thought it would work if I had it selected in the projects panel but it need to be active in the comp panel. Silly me haha

Thanks for your help!


Return to posts index

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