Nicholas Joseph
Forum Replies Created
-
Hi there Dan…Its been a few days..and I’m back. 🙂
I’m having an issue with finding a length of a string.
so… here is what I have…
var mySelection = app.project.selection; (selection of a .mov file with the name “smf_zzh110_v10”) and what I get is a string array with “smf_zzh110_v10” stored in index 0.
but now…I want to get the lenght of the array of index[0].
when I use “alert(mySelection[0].length)” i get an error.How would I go about removing “zzh110” from the string[0].
so pretty much how to get the length of an array inside of an array.
Hope you can help…
Thanks Again
Nik
-
yooo… thanks.. I wasn’t quite sure what was going on in your example but i was able to understand pieces of it. Because my folders are always the same(same index) i was able to write this and it worked great. 😉
var RotoMaskFolder = rotoFiles[0].item(1).item(1).item(1);
var numberItems = RotoMaskFolder.numItems;
for(var i = numberItems; i >=1; i– )
{
//alert(RotoMaskFolder.item(i).name);
var matte = RotoMaskFolder.item(i).duplicate();
matte.name = RotoMaskFolder.item(i).name;
matte.parentFolder = _MFolder;
}Hey… are you the same Dan that owns the motionscript site??
i always use motionscript.com and nabscripts.com for reference.thanks again
-
hi Dan…Im back 🙂
Can you help me with an issue I am having please…
I am having trouble accessing info/data from an imported file.Check out the image
So I have these folders and they are all set in variables.
I then use:function Roto()
{
rotoFiles = app.project.importFileWithDialog(); //the file is stored in array index 0
rotoFiles[0].parentFolder = _ROTOFolder;
}to import another AE file with a directory and some comps. (ROTOTEST.AEP)
What I am trying to do to get the Comps from the rototest.aep folder and place them in the COMP>Precomp>_DM folder. Can you help me with that code please.
As always…Thank you very much for all your help. I owe you a pint.
Here is how I created the folders:
var compFolder;
var _DMFolder;
var PreCompFolder;
var _ELFolder;
var _MFolder;
var sourceFolder;
var _MMFolder;
var _ROTOFolder;function FolderStructure()
{
compFolder = app.project.items.addFolder(‘COMP’);
sourceFolder = app.project.items.addFolder(‘SOURCE’);
PreCompFolder = compFolder.items.addFolder(‘PRECOMP’);
_DMFolder = PreCompFolder .items.addFolder(‘_DM’);
_ELFolder = PreCompFolder .items.addFolder(‘_EL’);
_MFolder = PreCompFolder .items.addFolder(‘_M’);
_MMFolder = sourceFolder.items.addFolder(‘_MM’);
_ROTOFolder = sourceFolder.items.addFolder(‘_ROTO’);
} -
hey there again…ignor that last question…i was able to solve it.
Thanks for all your help Dan…Im sure I will have tons more questions 🙂 I am starting to understand a bit.
For all those who are in the same boat as me… Here are some notes that I took. Hopw it helps you get started aswell.
//Creates a new project
app.project.close(CloseOptions.DO_NOT_SAVE_CHANGES); //close without saving
app.newProject();
var proj = app.project;//Create Folders
var compFolder = app.project.items.addFolder('comp'); //Folder called COMP on root DIR//Sets Parent Folders
var compFolder = app.project.items.addFolder('comp'); //folder1
var compFolder2= app.project.items.addFolder('comp2');//folder2
compFolder2.parentFolder = compFolder;//makes folder 2 child of folder1
or
var compFolder = app.project.items.addFolder('comp'); //folder1
compFolder.items.addFolder('comp2');//creates folder2 inside of folder1//Import a file
var myfile = app.project.importFileWithDialog(); //the file is stored in array index 1//Makes child a partent of a folder
myfile[0].parentFolder = compFolder2;//Get file Attributes and set them to variables
var myfileWidth = myfile[0].width;
var myfileHeight = myfile[0].height;
var myfileFrameRate = myfile[0].pixelAspect;
var myfileFrameRate = myfile[0].duration;
var myfileFrameRate = myfile[0].frameRate;//Create comp with attributes of the file
var myComp = app.project.items.addComp( "Hello Comp1", myfile[0].width, myfile[0].height, myfile[0].pixelAspect,myfile[0].duration,myfile[0].frameRate);
//Create a comp in a folder as a child
var myComp = compFolder.items.addComp(attributes); //creates comp inside compFolder(comp)
or
var myComp = app.project.items.addComp(attributes); //Creates new comp on root directory
myComp.parentFolder = compFolder; //moves from the root to compFolder//Addin footage to comp
var newObj = myComp.layers.add(myfile[0]);//adds myfile to mycomphttps://www.mitchallen.com/aftereffects/2006/03/after-effects-scripting-101.html
https://forums.creativecow.net/thread/227/17300
https://www.adobe.com/products/aftereffects/pdfs/aftereffectscs3_scripting_guide.pdf -
sweet!! that worked… and this also works:
var compFolder = app.project.items.addFolder(‘comp’);
compFolder.items.addFolder(‘comp2’);thanks again
-
Awesome!!
does this only work with index. I create 2 folders and want the comp2 to be the child of comp1.
var proj = app.project;
var compFolder = app.project.items.addFolder(‘comp’);
var compFolder2= app.project.items.addFolder(‘comp2’);app.project.item(compFolder2).parentFolder = compFolder; //(error)
app.project.item(comp2).parentFolder = compFolder; //(error)
app.project.item(2).parentFolder = compFolder; //(works)I get an error with the last line because (‘compFolder2’) is not working. It works with (2) though. How would I use actual folder names or ids to call folders instead of index#.
thanks again for all your help. 🙂
-
so…I used the addComp() command to create a new empty comp with my settings. How would I write the “take whats in my array and put it in the comp” code?
this is what I have:
var proj = app.project;
var selection = proj.selection;
app.project.itemCollection.addComp(scene01, 1280, 720, 1, 61, 30)I’m trying to figure out what to put in the for loop to get the “selection” content into the “scene01” comp.
Thanks again for all your help 🙂
-
Dan your my new best friend 🙂
I hope I can abuse this by asking you more questions. 🙂
What is the best way to learn how to script in AE? I am a MAYA TD but it seems AE is 10 times harder than scripting in Maya. Do you have any resources that you recommend?Im also stuck again…I created the array that holds my clips…how would I create a new comp with these. The way I was thinking is to just create a comp with the settings of my clips and duplicating the clips and moving it. Do you know if there is a command that will just take the selected elements and create a comp more intuitively?
Thanks again for all your help. I really appreciate it.
-
I have about 100 or so source footage in my project and each one has a matching matte pass. What I am trying to create is a script that will set the beautyPass to index[0] and the alpha to [1]. Then I will have the script create a new comp with the name of [0] and put both [0] and [1] into that comp. then the script will apply a shift channels and blur to index[0] inside each new com.
Seems complicated but these shots are killing me. 🙁 SO I am trying to write this script to save whats left of the hair on my head. 🙂
thanks
-
ooOOO thats what I was looking for. Thankyou very much!!
It does select based on whats selected from the top down. Is there a way to have the array index be assigned based on what was selected first.eg. clip02 selected and then clip01 and clip03 and have clip02 be [0], clip01 be [1] and clip03 [2].
thanks again for your help.
