Photoshop Scripting in to change the color of an existing vector shape

New Here ,
May 07, 2021 May 07, 2021

Copy link to clipboard


I want to open an existing Photoshop file and select a layer called Square. There is a vector shape in this layer. I want to change the color of this vector shape. That is all.

I tried many things to approach the vector like:

test = docRef.layers("Square")
test = docRef.pathItem("Square")

All attempts failed.

I guessed it worked like a text item which I finally got to work after a full day:

  textColor = CreateObject("Photoshop.SolidColor")
        textColor.RGB.Red = 255
        textColor.RGB.Green = 0
        textColor.RGB.Blue = 0
        textItemRef.Color = textColor

This absolutely works. I don't understand how a vector shape can be so much more difficult to change.

I am not smart enough to understand Objects.Properties.Methods and such so I need a real world code example. So just referring to some guide won't help me at all. I must see working code in front of me alas. But if you can help, please do so. Without examples all code books are worthless to me.

Actions and scripting, How to, Problem or error, Windows







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

Have something to add?

Join the conversation