0

I have make this function so to get data of every layer with Bevel and Emboss effect, within a document. Now I am looking for a way to do the same thing, but excluding a specific group (layerSet).

function getLayersData()
{
    var lyrs = [];
    var layers = 1;
    while (true)
    {
        ref = new ActionReference();
        ref.putIndex(charIDToTypeID('Lyr '), layers);
        try
        {
            var d1 = executeActionGet(ref);
            var d2 = executeActionGet(ref);
            var d3 = executeActionGet(ref);
            var d4 = executeActionGet(ref);
        }
            catch (err)
        {
            break;
        };
        var c2t = function (s){return app.charIDToTypeID(s);};
        var s2t = function (s){return app.stringIDToTypeID(s);};
        var lyr = {};
        lyr.type = d1.getInteger(s2t("layerKind"));
        lyr.name = d1.getString(c2t("Nm  "));
        lyr.id = d1.getInteger(s2t("layerID"));
        if (checkbox1.value == true)
        {
            ref.putEnumerated( c2t("Lyr "), c2t("Ordn"), c2t("Trgt") );
            if (d1.hasKey(s2t('layerEffects')))
            {
                d1 = d1.getObjectValue(s2t('layerEffects'));
                if (d1.hasKey(s2t('bevelEmboss')))
                {
                    d1 = d1.getObjectValue(s2t('bevelEmboss'));
                        // etc
                    d2 = d1.getObjectValue(s2t('highlightColor'));
                        // etc
                    d3 = d1.getObjectValue(s2t('shadowColor'));
                        // etc
                    d4 = d1.getObjectValue(c2t('TrnS'));
                        // etc
                    lyrs.push(lyr);
                };
            };
        }
        else
        {
            lyrs.push(lyr);
        };
        layers++;
    };    
    return lyrs;
};

For example, let's say we have five groups by the names Group1, 2, 3, 4 and 5.

In each group we have four vectors with the same name. "Shape 1", all of them.

I want to list all these "Shape 1" vectors, except the ones within Group 5!!!

I have found the way to list all group names into another function. So I just need this function, the one I am showing, to check the parent name for every layer and if layer is a child of this group to be excluded!!!

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.