Answers.Body: <p>I do not know of and couldn't find a script that does this already but it would be certainly possible to write one. After Effects doesn't have a functionality built-in for that.</p>
  
  <p>With the help of ExtendScript you can write very powerful extensions for After Effects and its very easy to get going with it. Just open up the "Adobe ExtenScript Toolkit" that gets installed with every CS suite and load up an example for After Effects and have a look at the JavaScript documentation. While you can also script with AppleScript and Batch Script the documentation for the JavaScript version is a lot better.
  You can access it under the "Help" menu. Most importantly look at the After Effects Scripting guide. It can be found for different CS/CC versions <a href="http://www.adobe.com/devnet/aftereffects.html" rel="nofollow">here</a>.</p>
  
  <p>What I would do is start to iterate through all your compositions, grab the current composition in your iteration, get an array of all the layer names in that composition and then iterate with that array through all compositions and compare the array with the array of all the other compositions. Best to not sort the arrays in case you used generic names for layers and unique layer ordering is important.</p>
  
  <p>Unless you have micro changes in your duplicate comps like changed property values and keyframes this approach would be effective.
  If you do have micro changes you would, after having fetched all comps with duplicate layers, also have to access every layer in your array and compare every property with the corresponding layer in the other comp.</p>
  
  <p>You then delete all true duplicates of a comp and while doing that replace them with a link of your now unique comp in all occurrences in other comps.</p>
  
  <p>Shouldn't be much code but it could take some time to write if you have never used Adobe ExtendScript.</p>
  
  <p>On another note, a very helpful plugin to keep the composition import madness at a minimum is <a href="http://aescripts.com/bao-dynamic-comp/" rel="nofollow">BAO Dynamic Comp</a>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-19T16:38:16.140Z
Answers.Text: That kind of coding is beyond me ... but would be great if someone else wrote it! I wonder if there's a "suggestion box" at aescripts.com...
Answers.UserDisplayName: d0g
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-20T13:40:47.270Z
Answers.Text: This sounds like a good challenge.
Answers.UserDisplayName: stib
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-19T13:30:04.450Z
Answers.LastActivityDate: 2014-08-19T13:30:04.450Z
Answers.UserDisplayName: timonsku
Body: <p>I'm working on a giant project file that was obviously created by importing lots of other projects into one big one.</p>
  
  <p>Many of the comps use many of the same precomps ... from projects that were copies of each other ... so there are many precomps that are probably identical, but each is used in a different master comp.</p>
  
  <p>Is there any way to (a) check if 2 comps are truly identical?</p>
  
  <p>And (b) automatically replace all references to identical comps with references to just one copy, so that the project can then be properly reduced?</p>
  
Tags: <after-effects>
Title: Find/replace duplicate comps?
UserDisplayName: d0g
ThreadText: # Find/replace duplicate comps?
  
  (Asked by: username_0 on 2014-08-19)
  
  I'm working on a giant project file that was obviously created by importing lots of other projects into one big one.
  
  Many of the comps use many of the same precomps ... from projects that were copies of each other ... so there are many precomps that are probably identical, but each is used in a different master comp.
  
  Is there any way to (a) check if 2 comps are truly identical?
  
  And (b) automatically replace all references to identical comps with references to just one copy, so that the project can then be properly reduced?
  
  **Tags:** after-effects
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-08-19. Score: 2 | Accepted answer
  
  I do not know of and couldn't find a script that does this already but it would be certainly possible to write one. After Effects doesn't have a functionality built-in for that.
  
  With the help of ExtendScript you can write very powerful extensions for After Effects and its very easy to get going with it. Just open up the "Adobe ExtenScript Toolkit" that gets installed with every CS suite and load up an example for After Effects and have a look at the JavaScript documentation. While you can also script with AppleScript and Batch Script the documentation for the JavaScript version is a lot better.
  You can access it under the "Help" menu. Most importantly look at the After Effects Scripting guide. It can be found for different CS/CC versions [here](http://www.adobe.com/devnet/aftereffects.html).
  
  What I would do is start to iterate through all your compositions, grab the current composition in your iteration, get an array of all the layer names in that composition and then iterate with that array through all compositions and compare the array with the array of all the other compositions. Best to not sort the arrays in case you used generic names for layers and unique layer ordering is important.
  
  Unless you have micro changes in your duplicate comps like changed property values and keyframes this approach would be effective.
  If you do have micro changes you would, after having fetched all comps with duplicate layers, also have to access every layer in your array and compare every property with the corresponding layer in the other comp.
  
  You then delete all true duplicates of a comp and while doing that replace them with a link of your now unique comp in all occurrences in other comps.
  
  Shouldn't be much code but it could take some time to write if you have never used Adobe ExtendScript.
  
  On another note, a very helpful plugin to keep the composition import madness at a minimum is [BAO Dynamic Comp](http://aescripts.com/bao-dynamic-comp/).
  
  > **Comments:**
  > **username_0**: That kind of coding is beyond me ... but would be great if someone else wrote it! I wonder if there's a "suggestion box" at aescripts.com...  
  > **username_2**: This sounds like a good challenge.  
  
  ---
  
  