Skip to main content
smithcgl9043167
Inspiring
January 3, 2020
Question

Custom shape list in latest version of Photoshop.

  • January 3, 2020
  • 2 replies
  • 2770 views

Hello everyone!
Could CC 2020 - 21.0.0 Release display the list of custom shapes with scripts?
So far I found nothing about it, some scripts of mine have stopped because they depend on the list. What help is well appreciated..

This topic has been closed for replies.

2 replies

greless
Inspiring
January 4, 2020

Is that what you want?

alert(getPresetList());
 
function getPresetList(){  
var ref = new ActionReference();   
   ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );   
   var appDesc = executeActionGet(ref);   
  var List = appDesc.getList(stringIDToTypeID('presetManager'));  
   
  var presetNames=[];  
    var list = List.getObjectValue(6).getList(charIDToTypeID('Nm  '));  
    // alert( list.getType(0));  
    for (var i = 0; i < list.count; i++) {  
      var str = list.getString(i);  
      str += "\n";
   //   logInfo(str)
      presetNames.push(str);  
    }  
return presetNames;  
}  
smithcgl9043167
Inspiring
January 4, 2020

Hi, 龚亮g64532194 on PS 2020 this script has stopped working, works fine in previous versions. Thanks.

JJMack
Community Expert
Community Expert
January 5, 2020

Have you reported the bug to Adobe yet? Photoshop Family 

JJMack
JJMack
Community Expert
Community Expert
January 3, 2020

Sure in X's Xtool in its App folder there is a s script "PresetLister.js"  the will list all preset including Custom shapes.   Custom shapes can have duplicate names as other custom shaped the also have a unique identifier.  However, in Photoshop 2020 Adobe made some changes that seems to have broken things like scripts. There now a Shapes Palette that has groups of shapes. Script that I have theat add Shape by Name using Action manager code still work.

var SB = activeDocument.activeLayer.bounds;
//var SB = app.activeDocument.selection.bounds;		// Get the bounds of the selection
top=SB[1].value;
left=SB[0].value;
bottom=SB[3].value;
right=SB[2].value;
rc=top + ":" + left + ":" + bottom + ":" + right;
Name="Chris";
Name= prompt("Shape Name ",Name);
addShape(Name,rc); 

function addShape(name,bounds) {
	top=bounds.substr(0,bounds.indexOf(":")); bounds=bounds.substr(bounds.indexOf(":")+1);
	left=bounds.substr(0,bounds.indexOf(":")); bounds=bounds.substr(bounds.indexOf(":")+1);
	bottom=bounds.substr(0,bounds.indexOf(":")); right=bounds.substr(bounds.indexOf(":")+1);
	// Add a Shape at resolution Black Fill no stroke
var idMk = charIDToTypeID( "Mk  " );
    var desc139 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref69 = new ActionReference();
        var idcontentLayer = stringIDToTypeID( "contentLayer" );
        ref69.putClass( idcontentLayer );
    desc139.putReference( idnull, ref69 );
    var idUsng = charIDToTypeID( "Usng" );
        var desc140 = new ActionDescriptor();
        var idType = charIDToTypeID( "Type" );
            var desc141 = new ActionDescriptor();
            var idClr = charIDToTypeID( "Clr " );
                var desc142 = new ActionDescriptor();
                var idRd = charIDToTypeID( "Rd  " );
                desc142.putDouble( idRd, 0.000000 );
                var idGrn = charIDToTypeID( "Grn " );
                desc142.putDouble( idGrn, 0.000000 );
                var idBl = charIDToTypeID( "Bl  " );
                desc142.putDouble( idBl, 0.000000 );
            var idRGBC = charIDToTypeID( "RGBC" );
            desc141.putObject( idClr, idRGBC, desc142 );
        var idsolidColorLayer = stringIDToTypeID( "solidColorLayer" );
        desc140.putObject( idType, idsolidColorLayer, desc141 );
        var idShp = charIDToTypeID( "Shp " );
            var desc143 = new ActionDescriptor();
            var idNm = charIDToTypeID( "Nm  " );
            desc143.putString( idNm, name );
            var idTop = charIDToTypeID( "Top " );
            var idPxl = charIDToTypeID( "#Pxl" );
            desc143.putUnitDouble( idTop, idPxl, top );
            var idLeft = charIDToTypeID( "Left" );
            var idPxl = charIDToTypeID( "#Pxl" );
            desc143.putUnitDouble( idLeft, idPxl, left );
            var idBtom = charIDToTypeID( "Btom" );
            var idPxl = charIDToTypeID( "#Pxl" );
            desc143.putUnitDouble( idBtom, idPxl, bottom );
            var idRght = charIDToTypeID( "Rght" );
            var idPxl = charIDToTypeID( "#Pxl" );
            desc143.putUnitDouble( idRght, idPxl, right );
        var idcustomShape = stringIDToTypeID( "customShape" );
        desc140.putObject( idShp, idcustomShape, desc143 );
        var idstrokeStyle = stringIDToTypeID( "strokeStyle" );
            var desc144 = new ActionDescriptor();
            var idstrokeStyleVersion = stringIDToTypeID( "strokeStyleVersion" );
            desc144.putInteger( idstrokeStyleVersion, 2 );
            var idstrokeEnabled = stringIDToTypeID( "strokeEnabled" );
            desc144.putBoolean( idstrokeEnabled, false );
            var idfillEnabled = stringIDToTypeID( "fillEnabled" );
            desc144.putBoolean( idfillEnabled, true );
            var idstrokeStyleLineWidth = stringIDToTypeID( "strokeStyleLineWidth" );
            var idPnt = charIDToTypeID( "#Pnt" );
            desc144.putUnitDouble( idstrokeStyleLineWidth, idPnt, 2.000000 );
            var idstrokeStyleLineDashOffset = stringIDToTypeID( "strokeStyleLineDashOffset" );
            var idPnt = charIDToTypeID( "#Pnt" );
            desc144.putUnitDouble( idstrokeStyleLineDashOffset, idPnt, 0.000000 );
            var idstrokeStyleMiterLimit = stringIDToTypeID( "strokeStyleMiterLimit" );
            desc144.putDouble( idstrokeStyleMiterLimit, 100.000000 );
            var idstrokeStyleLineCapType = stringIDToTypeID( "strokeStyleLineCapType" );
            var idstrokeStyleLineCapType = stringIDToTypeID( "strokeStyleLineCapType" );
            var idstrokeStyleButtCap = stringIDToTypeID( "strokeStyleButtCap" );
            desc144.putEnumerated( idstrokeStyleLineCapType, idstrokeStyleLineCapType, idstrokeStyleButtCap );
            var idstrokeStyleLineJoinType = stringIDToTypeID( "strokeStyleLineJoinType" );
            var idstrokeStyleLineJoinType = stringIDToTypeID( "strokeStyleLineJoinType" );
            var idstrokeStyleMiterJoin = stringIDToTypeID( "strokeStyleMiterJoin" );
            desc144.putEnumerated( idstrokeStyleLineJoinType, idstrokeStyleLineJoinType, idstrokeStyleMiterJoin );
            var idstrokeStyleLineAlignment = stringIDToTypeID( "strokeStyleLineAlignment" );
            var idstrokeStyleLineAlignment = stringIDToTypeID( "strokeStyleLineAlignment" );
            var idstrokeStyleAlignInside = stringIDToTypeID( "strokeStyleAlignInside" );
            desc144.putEnumerated( idstrokeStyleLineAlignment, idstrokeStyleLineAlignment, idstrokeStyleAlignInside );
            var idstrokeStyleScaleLock = stringIDToTypeID( "strokeStyleScaleLock" );
            desc144.putBoolean( idstrokeStyleScaleLock, false );
            var idstrokeStyleStrokeAdjust = stringIDToTypeID( "strokeStyleStrokeAdjust" );
            desc144.putBoolean( idstrokeStyleStrokeAdjust, false );
            var idstrokeStyleLineDashSet = stringIDToTypeID( "strokeStyleLineDashSet" );
                var list13 = new ActionList();
            desc144.putList( idstrokeStyleLineDashSet, list13 );
            var idstrokeStyleBlendMode = stringIDToTypeID( "strokeStyleBlendMode" );
            var idBlnM = charIDToTypeID( "BlnM" );
            var idNrml = charIDToTypeID( "Nrml" );
            desc144.putEnumerated( idstrokeStyleBlendMode, idBlnM, idNrml );
            var idstrokeStyleOpacity = stringIDToTypeID( "strokeStyleOpacity" );
            var idPrc = charIDToTypeID( "#Prc" );
            desc144.putUnitDouble( idstrokeStyleOpacity, idPrc, 100.000000 );
            var idstrokeStyleContent = stringIDToTypeID( "strokeStyleContent" );
                var desc145 = new ActionDescriptor();
                var idClr = charIDToTypeID( "Clr " );
                    var desc146 = new ActionDescriptor();
                    var idRd = charIDToTypeID( "Rd  " );
                    desc146.putDouble( idRd, 85.998688 );
                    var idGrn = charIDToTypeID( "Grn " );
                    desc146.putDouble( idGrn, 37.003326 );
                    var idBl = charIDToTypeID( "Bl  " );
                    desc146.putDouble( idBl, 17.999725 );
                var idRGBC = charIDToTypeID( "RGBC" );
                desc145.putObject( idClr, idRGBC, desc146 );
            var idsolidColorLayer = stringIDToTypeID( "solidColorLayer" );
            desc144.putObject( idstrokeStyleContent, idsolidColorLayer, desc145 );
            var idstrokeStyleResolution = stringIDToTypeID( "strokeStyleResolution" );
            desc144.putDouble( idstrokeStyleResolution, 182.880005 );
        var idstrokeStyle = stringIDToTypeID( "strokeStyle" );
        desc140.putObject( idstrokeStyle, idstrokeStyle, desc144 );
    var idcontentLayer = stringIDToTypeID( "contentLayer" );
    desc139.putObject( idUsng, idcontentLayer, desc140 );
executeAction( idMk, desc139, DialogModes.NO );

}

 

CC 2019 still works

JJMack
smithcgl9043167
Inspiring
January 3, 2020

Unfortunately, it does not show custom shapes in the current version.

 

 

JJMack
Community Expert
Community Expert
January 3, 2020

X's script does not work in PS 2020 for custom shapes So I do not know how to gets a list in 2020. Action Manager code still seems to be able to add shapes layer using shape names. 

 

Adobe Remove Shape management from Preset manager in PS 2020 and added a Shape palette where you manage shapes in group  folder.  The way X retrieved Shape Names no longer works in Photoshop 2020.

 

JJMack