<p>Scripting can do anything you can do with the UI. This isn't something you can do with the UI, so no, you can't do it with scripting. If you change the colour of precomp1.layer1.simpleRectangleLayer then it changes for all instances of precomp1. That's how precomps work.</p>

<p>You'd have to make a script that would do the same thing you'd have to do with the UI—duplicate precomp1 to make precomp2, change the colour of the layer and replace the source of layer2 to precomp2. I did make a script that does this kinda. It lets you duplicate a layer and make a duplicate of its source so that it can be changed. Available (free, open source) <a href="https://blob.pureandapplied.com.au/the-cloninator/" rel="nofollow noreferrer">here</a> (caveat: there are some bugs I've never found the time to iron out).</p>

CC BY-SA 4.0
2018-12-12T16:27:58.273Z
That's cool, thanks! I also figured out that I can use a hue/saturation effect on the precomp to make the background color change. Since the stroke is black it doesn't change at all.
Jacksonkr
CC BY-SA 4.0
2018-12-12T07:15:33.257Z
2018-12-12T07:15:33.257Z
stib
<p><strong>The Setup</strong></p>

<pre><code>- PreComp1
-- PreCompLayer1
--- simpleRectangleLayer

- Main Timeline
-- layer1
--- [PreComp1]
-- layer2
--- [PreComp1]
</code></pre>

<p><strong>Question</strong></p>

<p>Using only scripting is it possible to modify the inside of a single precomp instance? eg. change the color of <code>layer1.PreComp1.simpleRectangleLayer</code></p>

<after-effects><after-effects-expressions><after-effects-scripting>
Is it possible to modify a single precomp instance via scripting?
Jacksonkr
# Is it possible to modify a single precomp instance via scripting?

(Asked by: username_0 on 2018-12-11)

The Setup
- PreComp1
-- PreCompLayer1
--- simpleRectangleLayer

- Main Timeline
-- layer1
--- [PreComp1]
-- layer2
--- [PreComp1]

Question
Using only scripting is it possible to modify the inside of a single precomp instance? eg. change the color of layer1.PreComp1.simpleRectangleLayer

**Tags:** after-effects, after-effects-expressions, after-effects-scripting


---

## 1 answers

### Answer by username_1 on 2018-12-12. Score: 2 | Accepted answer

Scripting can do anything you can do with the UI. This isn't something you can do with the UI, so no, you can't do it with scripting. If you change the colour of precomp1.layer1.simpleRectangleLayer then it changes for all instances of precomp1. That's how precomps work.

You'd have to make a script that would do the same thing you'd have to do with the UI—duplicate precomp1 to make precomp2, change the colour of the layer and replace the source of layer2 to precomp2. I did make a script that does this kinda. It lets you duplicate a layer and make a duplicate of its source so that it can be changed. Available (free, open source) [here](https://blob.pureandapplied.com.au/the-cloninator/) (caveat: there are some bugs I've never found the time to iron out).

> **Comments:**
> **username_0**: That's cool, thanks! I also figured out that I can use a hue/saturation effect on the precomp to make the background color change. Since the stroke is black it doesn't change at all.  

---

