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..
thanks for the help
Senthuran
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
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);
}
})();
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
thanks for the help
Senthuran
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?
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
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.
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.
Copy link to clipboard
Copied
Thanks for your help