Photoshop: How to get list of layer comps in smart object using a script?

  • 3
  • Question
  • Updated 10 months ago
  • Answered
  • (Edited)
Hard question. Chris Cox could know it.

1) How to get list of layer comps in smart object?
2) How to check which is active?
3) How to compare layer comps which is set in root document and comps which is inside smart object?

I tried use script listener.

This is change layer comps from root document.
// =======================================================
var idsetPlacedLayerComp = stringIDToTypeID( "setPlacedLayerComp" );
    var desc69 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref20 = new ActionReference();
        var idLyr = charIDToTypeID( "Lyr " );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idTrgt = charIDToTypeID( "Trgt" );
        ref20.putEnumerated( idLyr, idOrdn, idTrgt );
    desc69.putReference( idnull, ref20 );
    var idcompID = stringIDToTypeID( "compID" );
    desc69.putInteger( idcompID, 986290194 );
executeAction( idsetPlacedLayerComp, desc69, DialogModes.NO );

This is how looks change comps inside smart object. I used layer comps panel instead properties panel in first example.
//======================================================= 
var idapplyComp = stringIDToTypeID( "applyComp" );
    var desc75 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref24 = new ActionReference();
        var idcompsClass = stringIDToTypeID( "compsClass" );
        ref24.putName( idcompsClass, "Kompozice vrstev 1" );
    desc75.putReference( idnull, ref24 );
executeAction( idapplyComp, desc75, DialogModes.NO );

How can I compare if 986290194 == "Kompozice vrstev 1" ?
How can I get full list of numers like 986290194 ?
I didn't found this in documentation.

I wan't make script like this: http://blog.darkwark.com/expandSmartObject/ but better. It's really, really important in my workflow.

Thanks for the answers
Photo of Jaroslav Bereza

Jaroslav Bereza

  • 810 Posts
  • 188 Reply Likes
  • lost in code

Posted 3 years ago

  • 3

There are no replies.