- January 29, 2020 at 7:50 am
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")));
- January 29, 2020 at 8:17 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;
My Envato portfolio.
- January 30, 2020 at 3:30 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!
- January 30, 2020 at 3:37 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.
- February 5, 2020 at 1:08 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!
Log in to reply.