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 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.

  • Isnt color the property of a layer not the vector shape? – joojaa May 7 at 18:54
  • Probably. But I do not know how to approach the right object and change its property. I do have links to guides if you can understand those. It mentions all objects and whatnot. Thing is, there are no examples whatsoever so I'm unable to use any. – Geoff Vane May 7 at 20:39
  • If you're going VB scrioting you're pretty much alone. If you're not sure what you're doing, JS script is far more doable – Sergey Kritskiy May 8 at 6:20
  • @SergeyKritskiy nearly same API a bit different call names. But you can pretty much read a java script file and convert it to VB by changing capitalization rules. I prefer to use python over VB instead but no biggie. Its just that i don't do much Photoshop scripting that requires inter process communication (like say you wanted a change in excel register in Photoshop automatically, which is trivial in a COM application but impossible in the jsx engine). I certainly don't do vector stuff in Photoshop.. – joojaa May 8 at 8:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.