Photoshop + Python + Actions - Changing Layer Color through script


So there doesn’t appear to be a method to change the color of a layer through the ArtLayer object.

Using the Script Listener I can get a giant mess of ugly VB or JS… but now I would like to convert it to python…

Anyone got any tips for swimming these murky waters? Here is what the VB looks like for changing a layer’s color to Orange.

REM =======================================================
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
DIM idsetd
idsetd = objApp.CharIDToTypeID( "setd" )
    DIM desc6
    SET desc6 = CreateObject( "Photoshop.ActionDescriptor" )
    DIM idnull
    idnull = objApp.CharIDToTypeID( "null" )
        DIM ref3
        SET ref3 = CreateObject( "Photoshop.ActionReference" )
        DIM idLyr
        idLyr = objApp.CharIDToTypeID( "Lyr " )
        DIM idOrdn
        idOrdn = objApp.CharIDToTypeID( "Ordn" )
        DIM idTrgt
        idTrgt = objApp.CharIDToTypeID( "Trgt" )
        Call ref3.PutEnumerated( idLyr, idOrdn, idTrgt )
    Call desc6.PutReference( idnull, ref3 )
    DIM idT
    idT = objApp.CharIDToTypeID( "T   " )
        DIM desc7
        SET desc7 = CreateObject( "Photoshop.ActionDescriptor" )
        DIM idClr
        idClr = objApp.CharIDToTypeID( "Clr " )
        DIM idClr
        idClr = objApp.CharIDToTypeID( "Clr " )
        DIM idOrng
        idOrng = objApp.CharIDToTypeID( "Orng" )
        Call desc7.PutEnumerated( idClr, idClr, idOrng )
    DIM idLyr
    idLyr = objApp.CharIDToTypeID( "Lyr " )
    Call desc6.PutObject( idT, idLyr, desc7 )
Call objApp.ExecuteAction( idsetd, desc6, dialogMode )


You can convert this code very easily in Python! If you still need help, hit me up! :slight_smile: