Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

How can I reference a custom shape's name?

$
0
0

When you create a custom shape you are allowed to give that custom shape a name. I want to create a script that alerts a custom shape's name. How can I therefore store a custom shapes name in a variable or in any way reference this name?


The intended procedure is to reference the custom shape name so I can manipulate it upon creation of said custom shape.

I activated script listener and I can see that when I create a custom shape that is named scissors 2 the log file records this code in relation with the name:

 

    var desc41 = new ActionDescriptor();

    var idNm = charIDToTypeID( "Nm  " );

     desc41.putString( idNm, """Scissors 2""" );

===============================================================================

 

This other, is all the code that is created in the log file when I create a custom shape:

 

var idslct = charIDToTypeID( "slct" );

    var desc36 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

        var ref14 = new ActionReference();

        var idcustomShapeTool = stringIDToTypeID( "customShapeTool" );

        ref14.putClass( idcustomShapeTool );

    desc36.putReference( idnull, ref14 );

    var iddontRecord = stringIDToTypeID( "dontRecord" );

    desc36.putBoolean( iddontRecord, true );

    var idforceNotify = stringIDToTypeID( "forceNotify" );

    desc36.putBoolean( idforceNotify, true );

executeAction( idslct, desc36, DialogModes.NO );

 

 

// =======================================================

var idMk = charIDToTypeID( "Mk  " );

    var desc37 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

        var ref15 = new ActionReference();

        var idcontentLayer = stringIDToTypeID( "contentLayer" );

        ref15.putClass( idcontentLayer );

    desc37.putReference( idnull, ref15 );

    var idUsng = charIDToTypeID( "Usng" );

        var desc38 = new ActionDescriptor();

        var idType = charIDToTypeID( "Type" );

            var desc39 = new ActionDescriptor();

            var idClr = charIDToTypeID( "Clr " );

                var desc40 = new ActionDescriptor();

                var idRd = charIDToTypeID( "Rd  " );

                desc40.putDouble( idRd, 0.000000 );

                var idGrn = charIDToTypeID( "Grn " );

                desc40.putDouble( idGrn, 0.000000 );

                var idBl = charIDToTypeID( "Bl  " );

                desc40.putDouble( idBl, 0.000000 );

            var idRGBC = charIDToTypeID( "RGBC" );

            desc39.putObject( idClr, idRGBC, desc40 );

        var idsolidColorLayer = stringIDToTypeID( "solidColorLayer" );

        desc38.putObject( idType, idsolidColorLayer, desc39 );

        var idShp = charIDToTypeID( "Shp " );

            var desc41 = new ActionDescriptor();

            var idNm = charIDToTypeID( "Nm  " );

            desc41.putString( idNm, """Scissors 2""" );

            var idTop = charIDToTypeID( "Top " );

            var idRlt = charIDToTypeID( "#Rlt" );

            desc41.putUnitDouble( idTop, idRlt, 89.000019 );

            var idLeft = charIDToTypeID( "Left" );

            var idRlt = charIDToTypeID( "#Rlt" );

            desc41.putUnitDouble( idLeft, idRlt, 232.000049 );

            var idBtom = charIDToTypeID( "Btom" );

            var idRlt = charIDToTypeID( "#Rlt" );

            desc41.putUnitDouble( idBtom, idRlt, 131.000028 );

            var idRght = charIDToTypeID( "Rght" );

            var idRlt = charIDToTypeID( "#Rlt" );

            desc41.putUnitDouble( idRght, idRlt, 293.000062 );

        var idcustomShape = stringIDToTypeID( "customShape" );

        desc38.putObject( idShp, idcustomShape, desc41 );

    var idcontentLayer = stringIDToTypeID( "contentLayer" );

    desc37.putObject( idUsng, idcontentLayer, desc38 );

executeAction( idMk, desc37, DialogModes.NO );

 

 

--------------------------------------------------

Thanks & hope you can help


Viewing all articles
Browse latest Browse all 12244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>