Creating a Composition in ExtendScript
Articles Blog

Creating a Composition in ExtendScript

October 22, 2019

Hello world and welcome to Coding After Effects Extend the Script series in this tutorial I want to teach you how to create a Composition use that ExtendScript and what we were looking at right now is the After Effects cs6 scripting guide PDF on the After Effects ExtendScript language so if you want to look up anything on how this language works You can check out this PDF and it give you a pretty good idea What’s going on in detail and far as what I know this is the most documented reference that That adobe has made Regarding a ExtendScript for After Effects so what are we looking at specifically right now is the After Effects object model and this model shows you how to access different parts of After Effects and each one of these squares or boxes represent objects that are inside of After Effects so On the right you can see system file folder and sockets. These are all individual and standalone objects that you can access in Adobe After Effects and what you have here on the left is application project render queue settings layers and As you can see over here you have a line kind of connecting each one of these objects to application and this is basically showing you the hierarchy of the object model and side of After Effects and You need to know how this works because in order to access anything Inside of After Effects as far as layers and composition or anything that’s connected to this line You first have to go through this hierarchy in able to Select it so for example if I needed to get to layers I first had to start at the top of the hierarchy and then go down So I will start off with application and then the next thing I need to access The project and then the item then the comp item and then I’m at then I’m able to access my lair Wish I can either create a layer Modify it or delete it or do anything I can usually do an After Effects The same thing goes with if I wanted to access my render queue I have to go through the same process by first going to Application and then the next on the hierarchy is the project and then I’m able to access my render queue I know this sounds a little bit confusing. But if I show you then this all makes sense So inside my so what I have inside of here in that sense script is I have a little reference to our Add Comp method that we need to use in able to create a Composition and these are just my arguments But right now it’s commented out and can’t do anything with it and I go into details in a second on How it works in everything you need to do to actually access it But first I’m going to create a alert Function and Inside of here. I’m going to put in our first object and we need to get to enable to get to our composition and if we look back into our reference sheet the first thing we have in our hierarchy is application so first I’m going to access application and then I’m going to go to project so in able to access Application I just write app and if I run it and go to After Effects You see object application which shows you or proves that this is an object And if I need to get to my next Object then I’ll write the dot and then whatever objects I’m trying to reach next which would be project as you can see right here application and then project so if I run this Go back to After Effects it’s a object project So, let’s look back into the PDF to see what we need to get next with this item So in here that item oops item With a “s”. Run time, I mean run it And we get item collection object And lastly would be our Composition that we need to access so we no longer need alert I’m just showing you that to prove that these are items and you are going through each item to access it and What we’re going to use to actually create a Composition like I said earlier we’re going to use this method called Add Comp each One of these Words represent an Argument and these arguments are going to be the details We need to create our composition which is first name and then the width and then the height and the aspect ratio the duration were how long I want my composition to be far as time and then the frames per second, so If I go back to After Effects you can see we have no composition right now So if I do everything right and if I come back and run it and if I go back to After Effects a composition should be made and far as our name we need to make quotes and then put in whatever we want to name our Composition. I’m just gonna call it main and For my width. I’m going to make it high definition. So I’m gonna put 920 For my height, I’m gonna put in 1080 For my aspect ratio. I’m gonna put in one And for my duration I it goes by second. So I wanted to be a minute. I’m putting in 60 And I want to make it standard film so 24 frames per second and if I run it and I go back to After Effects you can see we have the composition and if I Double click on it open it up and I push ctrl K And we look at the details of this composition you can see we have worth of 1920 height of 1080 frame rate of 24 and this is one second so we did everything we wanted to do with our Composition Forrest’s like creating it and this is basically it I Hope you learned something and if you enjoyed this video check out my other videos I have another vide o on ExtendScript that’s a little bit more beginner level and If you want to know more about Expression I got videos on that and to the next time peace out world

Leave a Reply

Your email address will not be published. Required fields are marked *