• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Help me to Move a image to another composition using Extendscript

New Here ,
Mar 16, 2018 Mar 16, 2018

Copy link to clipboard

Copied

HI,

I'm new to Extendscript Just now i start to lean. I like to know how Move a image to another composition using Extendscript in after effects

i need move my logo.png to your logo comp,

please provide the script according to my image..

Picture.png

thanks for the help

Senthuran

TOPICS
Scripting

Views

1.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Mar 17, 2018 Mar 17, 2018

There are lots of ways to do that, but in the nutshell it looks like this:

composition.layers.add(item);

For more information, please read After Effects Scripting Guide on page 52 https://blogs.adobe.com/creativecloud/files/2012/06/After-Effects-CS6-Scripting-Guide.pdf ​

In your example, you need to get composition YOUR LOGO first, then item logo.png. After that you can add it to composition.

Here's one of the possible ways to do so:

(function() {

    // Find composition

    var composition = findItemB

...

Votes

Translate

Translate
Advocate ,
Mar 17, 2018 Mar 17, 2018

Copy link to clipboard

Copied

There are lots of ways to do that, but in the nutshell it looks like this:

composition.layers.add(item);

For more information, please read After Effects Scripting Guide on page 52 https://blogs.adobe.com/creativecloud/files/2012/06/After-Effects-CS6-Scripting-Guide.pdf ​

In your example, you need to get composition YOUR LOGO first, then item logo.png. After that you can add it to composition.

Here's one of the possible ways to do so:

(function() {

    // Find composition

    var composition = findItemByName("YOUR LOGO");

    if (!composition) {

        return;

    }

    // Find image

    var image = findItemByName("logo.png");

    if (!image) {

        return;

    }

    // Add image to composition

    composition.layers.add(image);

    function findItemByName(itemName) {

        for (var i = 1, il = app.project.numItems; i <= il; i++) {

            if (app.project.item(i).name === itemName) {

                return app.project.item(i);

            }

        }

        // return null if didn't find anything

        return alert("Could not find " + itemName);

    }

})();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 17, 2018 Mar 17, 2018

Copy link to clipboard

Copied

Brother thanks for your Help. really you make me happy.

I can pay cash to your paypal id please send that  . ( I'm not a rich person i can send some cash for your pocket money ),

i copy and paste your code and run nothing happens first time,  after that i made some changes it's worked fine, if you have time please explain me why it's worked after the changes

image_1.png

image_2.png

thanks for the help

Senthuran

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 17, 2018 Mar 17, 2018

Copy link to clipboard

Copied

There are many ways why it didn't work.

1. Maybe you didn't have composition YOUR LOGO in your project

2. Maybe you had more then one composition with same YOUR LOGO name

3. Maybe you didn't have composition, but had some other item named YOUR LOGO

4. Maybe you had a space in YOUR LOGO name

5. Maybe you didn't have "logo.png" in your project.

etc etc.

I just tried running the script from ESTK as you have, and it worked in first try.

Did you get the alert "Could not find XXX" once you ran it first time?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 19, 2018 Mar 19, 2018

Copy link to clipboard

Copied

HI

I made a video. can you check and help me how we can fix that please

https://www.dropbox.com/s/y6kl6a9r30e7alv/screencap.wmv?dl=0

Regards

Senthuran

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 19, 2018 Mar 19, 2018

Copy link to clipboard

Copied

Well, in your screencast, you don't copy the entire script that Tom gave you.

Copy the all thing !! Including ALL parentheses and semicolon.

I tried, It works.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 19, 2018 Mar 19, 2018

Copy link to clipboard

Copied

I second phlexib​ - you need to copy entire code.

Right now you are pasting only function declaration, without ever invoking/calling it. That's why it has those extra parenthesis in there, it's called IIFE, as in Immediately Invoked Function Expression.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 21, 2018 Mar 21, 2018

Copy link to clipboard

Copied

LATEST

Thanks for your help

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines