Skip to main content
Participating Frequently
January 14, 2024
Answered

Select All Layers Except Layer Groups and Text Layer!

  • January 14, 2024
  • 2 replies
  • 1452 views

Hello, is there any way to select all layers except layer group and layer text?

 

I wish there was some way to select all the layers: layer, adjustment layer, mask layer, and so on. All layers except layer groups and text layers

 

The first option I found was using Auto Select activated and selecting the "Layer" option, and it even works but the layers that are not visible do not show them, so it does not solve the problem itself.

 

The second option was to select all the layers and deactivate the groups manually, which is also a bit of a hassle when you have a lot of subgroups.

 

So the result is that I'm still looking for a possible solution, better than the previous ones mentioned, if anyone has suggestions and tips, I would be very grateful for the contribution!

 

That would be the expected result!

 

This topic has been closed for replies.
Correct answer Stephen Marsh

I think that I know of a script that could be modified... I'll post back later when I have time.

 

EDIT: Courtesy of @jazz-y 

 

Selecting all required layers, which is a bit verbose:

 

 

//community.adobe.com/t5/photoshop/select-only-the-text-layers/m-p/11017843
// jazz-y

// Select ALL Layers of Specific Layer Kind - Works with layer sets and nested sets!

var AM = new ActionManager
    if (app.documents.length) selectLayerKind ()

function selectLayerKind() {
    var output = [],
        from = AM.getDocProperty('hasBackgroundLayer') ? 0 : 1,
        to = AM.getDocProperty('numberOfLayers')
        
        if (to) AM.deselectLayers ()
        
    for (var i = from; i <= to; i++) {

        // Any Layer = 0
        // Pixel Layer  = 1 (including Background layer)
        // Adjustment Layer = 2
        // Text Layer = 3
        // Vector Layer = 4
        // SmartObject Layer = 5
        // Video Layer = 6
        // LayerGroup Layer = 7
        // 3D Layer = 8
        // Gradient Layer = 9
        // Pattern Layer = 10
        // Solid Color Layer = 11
        // Background Layer = 12
        // HiddenSectionBounder = 13

        if (AM.getLayerProperty('layerKind', i) == 1 || AM.getLayerProperty('layerKind', i) == 2 || AM.getLayerProperty('layerKind', i) == 5 || AM.getLayerProperty('layerKind', i) == 6 || AM.getLayerProperty('layerKind', i) == 8 || AM.getLayerProperty('layerKind', i) == 9 || AM.getLayerProperty('layerKind', i) == 10 || AM.getLayerProperty('layerKind', i) == 11 || AM.getLayerProperty('layerKind', i) == 12)
        AM.selectLayerByIndex(i, true)
    }
}

function ActionManager() {

    this.getDocProperty = function (property) {
        property = s2t(property)
        var ref = new ActionReference()
        ref.putProperty(s2t("property"), property)
        ref.putEnumerated(s2t("document"), s2t("ordinal"), s2t("targetEnum"))
        return getDescValue(executeActionGet(ref), property)
    }

    this.getLayerProperty = function (property, index) {
        property = s2t(property)
        var ref = new ActionReference()
        ref.putProperty(s2t("property"), property)
        ref.putIndex(s2t("layer"), index)
        return getDescValue(executeActionGet(ref), property)
    }

    this.selectLayerByIndex = function (idx, addToSelection) {
        var desc = new ActionDescriptor()
        var ref = new ActionReference()
        ref.putIndex(s2t("layer"), idx)
        desc.putReference(s2t("null"), ref)
        if (addToSelection) desc.putEnumerated(s2t("selectionModifier"), s2t("addToSelectionContinuous"), s2t("addToSelection"))
        executeAction(s2t("select"), desc, DialogModes.NO);
    }

    this.deselectLayers = function () {
        var desc = new ActionDescriptor()
        var ref = new ActionReference()
        ref.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"))
        desc.putReference(s2t("null"), ref)
        executeAction(s2t("selectNoLayers"), desc, DialogModes.NO)
    }

    function getDescValue(desc, property) {

        switch (desc.getType(property)) {
            case DescValueType.OBJECTTYPE:
                return (desc.getObjectValue(property));
                break;
            case DescValueType.LISTTYPE:
                return desc.getList(property);
                break;
            case DescValueType.REFERENCETYPE:
                return desc.getReference(property);
                break;
            case DescValueType.BOOLEANTYPE:
                return desc.getBoolean(property);
                break;
            case DescValueType.STRINGTYPE:
                return desc.getString(property);
                break;
            case DescValueType.INTEGERTYPE:
                return desc.getInteger(property);
                break;
            case DescValueType.LARGEINTEGERTYPE:
                return desc.getLargeInteger(property);
                break;
            case DescValueType.DOUBLETYPE:
                return desc.getDouble(property);
                break;
            case DescValueType.ALIASTYPE:
                return desc.getPath(property);
                break;
            case DescValueType.CLASSTYPE:
                return desc.getClass(property);
                break;
            case DescValueType.UNITDOUBLE:
                return (desc.getUnitDoubleValue(property));
                break;
            case DescValueType.ENUMERATEDTYPE:
                return (t2s(desc.getEnumerationValue(property)));
                break;
            case DescValueType.RAWTYPE:
                var tempStr = desc.getData(property);
                var rawData = new Array();
                for (var tempi = 0; tempi < tempStr.length; tempi++) {
                    rawData[tempi] = tempStr.charCodeAt(tempi);
                }
                return rawData;
                break;
            default:
                break;
        };
    }

    function s2t(s) { return stringIDToTypeID(s) }
    function t2s(t) { return typeIDToStringID(t) }
}

 

 

Or not selecting Text and Layer Groups, more concise:

 

 

//community.adobe.com/t5/photoshop/select-only-the-text-layers/m-p/11017843
// jazz-y

// Select ALL Layers of Specific Layer Kind - Works with layer sets and nested sets!

var AM = new ActionManager
    if (app.documents.length) selectLayerKind ()

function selectLayerKind() {
    var output = [],
        from = AM.getDocProperty('hasBackgroundLayer') ? 0 : 1,
        to = AM.getDocProperty('numberOfLayers')
        
        if (to) AM.deselectLayers ()
        
    for (var i = from; i <= to; i++) {

        // Any Layer = 0
        // Pixel Layer  = 1 (including Background layer)
        // Adjustment Layer = 2
        // Text Layer = 3
        // Vector Layer = 4
        // SmartObject Layer = 5
        // Video Layer = 6
        // LayerGroup Layer = 7
        // 3D Layer = 8
        // Gradient Layer = 9
        // Pattern Layer = 10
        // Solid Color Layer = 11
        // Background Layer = 12
        // HiddenSectionBounder = 13

        if (AM.getLayerProperty('layerKind', i) != 3 && AM.getLayerProperty('layerKind', i) != 7) AM.selectLayerByIndex (i,true) // Change the number as above!
    }
}

function ActionManager() {

    this.getDocProperty = function (property) {
        property = s2t(property)
        var ref = new ActionReference()
        ref.putProperty(s2t("property"), property)
        ref.putEnumerated(s2t("document"), s2t("ordinal"), s2t("targetEnum"))
        return getDescValue(executeActionGet(ref), property)
    }

    this.getLayerProperty = function (property, index) {
        property = s2t(property)
        var ref = new ActionReference()
        ref.putProperty(s2t("property"), property)
        ref.putIndex(s2t("layer"), index)
        return getDescValue(executeActionGet(ref), property)
    }

    this.selectLayerByIndex = function (idx, addToSelection) {
        var desc = new ActionDescriptor()
        var ref = new ActionReference()
        ref.putIndex(s2t("layer"), idx)
        desc.putReference(s2t("null"), ref)
        if (addToSelection) desc.putEnumerated(s2t("selectionModifier"), s2t("addToSelectionContinuous"), s2t("addToSelection"))
        executeAction(s2t("select"), desc, DialogModes.NO);
    }

    this.deselectLayers = function () {
        var desc = new ActionDescriptor()
        var ref = new ActionReference()
        ref.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"))
        desc.putReference(s2t("null"), ref)
        executeAction(s2t("selectNoLayers"), desc, DialogModes.NO)
    }

    function getDescValue(desc, property) {

        switch (desc.getType(property)) {
            case DescValueType.OBJECTTYPE:
                return (desc.getObjectValue(property));
                break;
            case DescValueType.LISTTYPE:
                return desc.getList(property);
                break;
            case DescValueType.REFERENCETYPE:
                return desc.getReference(property);
                break;
            case DescValueType.BOOLEANTYPE:
                return desc.getBoolean(property);
                break;
            case DescValueType.STRINGTYPE:
                return desc.getString(property);
                break;
            case DescValueType.INTEGERTYPE:
                return desc.getInteger(property);
                break;
            case DescValueType.LARGEINTEGERTYPE:
                return desc.getLargeInteger(property);
                break;
            case DescValueType.DOUBLETYPE:
                return desc.getDouble(property);
                break;
            case DescValueType.ALIASTYPE:
                return desc.getPath(property);
                break;
            case DescValueType.CLASSTYPE:
                return desc.getClass(property);
                break;
            case DescValueType.UNITDOUBLE:
                return (desc.getUnitDoubleValue(property));
                break;
            case DescValueType.ENUMERATEDTYPE:
                return (t2s(desc.getEnumerationValue(property)));
                break;
            case DescValueType.RAWTYPE:
                var tempStr = desc.getData(property);
                var rawData = new Array();
                for (var tempi = 0; tempi < tempStr.length; tempi++) {
                    rawData[tempi] = tempStr.charCodeAt(tempi);
                }
                return rawData;
                break;
            default:
                break;
        };
    }

    function s2t(s) { return stringIDToTypeID(s) }
    function t2s(t) { return typeIDToStringID(t) }
}

 

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

2 replies

Stephen Marsh
Braniac
January 14, 2024

I would use a script, but the trick will be finding or writing it!

Participating Frequently
January 15, 2024

Unfortunately, I've been looking for it for hours but I haven't found it, I believe it doesn't exist and the only option left is to write it or even get around the situation with options like the one mentioned by @Myra Ferguson 

 

Would the script for this type of function be too much work to write? We would have to filter out all the other options that we don't want, right!

Stephen Marsh
Stephen MarshCorrect answer
Braniac
January 15, 2024

I think that I know of a script that could be modified... I'll post back later when I have time.

 

EDIT: Courtesy of @jazz-y 

 

Selecting all required layers, which is a bit verbose:

 

 

//community.adobe.com/t5/photoshop/select-only-the-text-layers/m-p/11017843
// jazz-y

// Select ALL Layers of Specific Layer Kind - Works with layer sets and nested sets!

var AM = new ActionManager
    if (app.documents.length) selectLayerKind ()

function selectLayerKind() {
    var output = [],
        from = AM.getDocProperty('hasBackgroundLayer') ? 0 : 1,
        to = AM.getDocProperty('numberOfLayers')
        
        if (to) AM.deselectLayers ()
        
    for (var i = from; i <= to; i++) {

        // Any Layer = 0
        // Pixel Layer  = 1 (including Background layer)
        // Adjustment Layer = 2
        // Text Layer = 3
        // Vector Layer = 4
        // SmartObject Layer = 5
        // Video Layer = 6
        // LayerGroup Layer = 7
        // 3D Layer = 8
        // Gradient Layer = 9
        // Pattern Layer = 10
        // Solid Color Layer = 11
        // Background Layer = 12
        // HiddenSectionBounder = 13

        if (AM.getLayerProperty('layerKind', i) == 1 || AM.getLayerProperty('layerKind', i) == 2 || AM.getLayerProperty('layerKind', i) == 5 || AM.getLayerProperty('layerKind', i) == 6 || AM.getLayerProperty('layerKind', i) == 8 || AM.getLayerProperty('layerKind', i) == 9 || AM.getLayerProperty('layerKind', i) == 10 || AM.getLayerProperty('layerKind', i) == 11 || AM.getLayerProperty('layerKind', i) == 12)
        AM.selectLayerByIndex(i, true)
    }
}

function ActionManager() {

    this.getDocProperty = function (property) {
        property = s2t(property)
        var ref = new ActionReference()
        ref.putProperty(s2t("property"), property)
        ref.putEnumerated(s2t("document"), s2t("ordinal"), s2t("targetEnum"))
        return getDescValue(executeActionGet(ref), property)
    }

    this.getLayerProperty = function (property, index) {
        property = s2t(property)
        var ref = new ActionReference()
        ref.putProperty(s2t("property"), property)
        ref.putIndex(s2t("layer"), index)
        return getDescValue(executeActionGet(ref), property)
    }

    this.selectLayerByIndex = function (idx, addToSelection) {
        var desc = new ActionDescriptor()
        var ref = new ActionReference()
        ref.putIndex(s2t("layer"), idx)
        desc.putReference(s2t("null"), ref)
        if (addToSelection) desc.putEnumerated(s2t("selectionModifier"), s2t("addToSelectionContinuous"), s2t("addToSelection"))
        executeAction(s2t("select"), desc, DialogModes.NO);
    }

    this.deselectLayers = function () {
        var desc = new ActionDescriptor()
        var ref = new ActionReference()
        ref.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"))
        desc.putReference(s2t("null"), ref)
        executeAction(s2t("selectNoLayers"), desc, DialogModes.NO)
    }

    function getDescValue(desc, property) {

        switch (desc.getType(property)) {
            case DescValueType.OBJECTTYPE:
                return (desc.getObjectValue(property));
                break;
            case DescValueType.LISTTYPE:
                return desc.getList(property);
                break;
            case DescValueType.REFERENCETYPE:
                return desc.getReference(property);
                break;
            case DescValueType.BOOLEANTYPE:
                return desc.getBoolean(property);
                break;
            case DescValueType.STRINGTYPE:
                return desc.getString(property);
                break;
            case DescValueType.INTEGERTYPE:
                return desc.getInteger(property);
                break;
            case DescValueType.LARGEINTEGERTYPE:
                return desc.getLargeInteger(property);
                break;
            case DescValueType.DOUBLETYPE:
                return desc.getDouble(property);
                break;
            case DescValueType.ALIASTYPE:
                return desc.getPath(property);
                break;
            case DescValueType.CLASSTYPE:
                return desc.getClass(property);
                break;
            case DescValueType.UNITDOUBLE:
                return (desc.getUnitDoubleValue(property));
                break;
            case DescValueType.ENUMERATEDTYPE:
                return (t2s(desc.getEnumerationValue(property)));
                break;
            case DescValueType.RAWTYPE:
                var tempStr = desc.getData(property);
                var rawData = new Array();
                for (var tempi = 0; tempi < tempStr.length; tempi++) {
                    rawData[tempi] = tempStr.charCodeAt(tempi);
                }
                return rawData;
                break;
            default:
                break;
        };
    }

    function s2t(s) { return stringIDToTypeID(s) }
    function t2s(t) { return typeIDToStringID(t) }
}

 

 

Or not selecting Text and Layer Groups, more concise:

 

 

//community.adobe.com/t5/photoshop/select-only-the-text-layers/m-p/11017843
// jazz-y

// Select ALL Layers of Specific Layer Kind - Works with layer sets and nested sets!

var AM = new ActionManager
    if (app.documents.length) selectLayerKind ()

function selectLayerKind() {
    var output = [],
        from = AM.getDocProperty('hasBackgroundLayer') ? 0 : 1,
        to = AM.getDocProperty('numberOfLayers')
        
        if (to) AM.deselectLayers ()
        
    for (var i = from; i <= to; i++) {

        // Any Layer = 0
        // Pixel Layer  = 1 (including Background layer)
        // Adjustment Layer = 2
        // Text Layer = 3
        // Vector Layer = 4
        // SmartObject Layer = 5
        // Video Layer = 6
        // LayerGroup Layer = 7
        // 3D Layer = 8
        // Gradient Layer = 9
        // Pattern Layer = 10
        // Solid Color Layer = 11
        // Background Layer = 12
        // HiddenSectionBounder = 13

        if (AM.getLayerProperty('layerKind', i) != 3 && AM.getLayerProperty('layerKind', i) != 7) AM.selectLayerByIndex (i,true) // Change the number as above!
    }
}

function ActionManager() {

    this.getDocProperty = function (property) {
        property = s2t(property)
        var ref = new ActionReference()
        ref.putProperty(s2t("property"), property)
        ref.putEnumerated(s2t("document"), s2t("ordinal"), s2t("targetEnum"))
        return getDescValue(executeActionGet(ref), property)
    }

    this.getLayerProperty = function (property, index) {
        property = s2t(property)
        var ref = new ActionReference()
        ref.putProperty(s2t("property"), property)
        ref.putIndex(s2t("layer"), index)
        return getDescValue(executeActionGet(ref), property)
    }

    this.selectLayerByIndex = function (idx, addToSelection) {
        var desc = new ActionDescriptor()
        var ref = new ActionReference()
        ref.putIndex(s2t("layer"), idx)
        desc.putReference(s2t("null"), ref)
        if (addToSelection) desc.putEnumerated(s2t("selectionModifier"), s2t("addToSelectionContinuous"), s2t("addToSelection"))
        executeAction(s2t("select"), desc, DialogModes.NO);
    }

    this.deselectLayers = function () {
        var desc = new ActionDescriptor()
        var ref = new ActionReference()
        ref.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"))
        desc.putReference(s2t("null"), ref)
        executeAction(s2t("selectNoLayers"), desc, DialogModes.NO)
    }

    function getDescValue(desc, property) {

        switch (desc.getType(property)) {
            case DescValueType.OBJECTTYPE:
                return (desc.getObjectValue(property));
                break;
            case DescValueType.LISTTYPE:
                return desc.getList(property);
                break;
            case DescValueType.REFERENCETYPE:
                return desc.getReference(property);
                break;
            case DescValueType.BOOLEANTYPE:
                return desc.getBoolean(property);
                break;
            case DescValueType.STRINGTYPE:
                return desc.getString(property);
                break;
            case DescValueType.INTEGERTYPE:
                return desc.getInteger(property);
                break;
            case DescValueType.LARGEINTEGERTYPE:
                return desc.getLargeInteger(property);
                break;
            case DescValueType.DOUBLETYPE:
                return desc.getDouble(property);
                break;
            case DescValueType.ALIASTYPE:
                return desc.getPath(property);
                break;
            case DescValueType.CLASSTYPE:
                return desc.getClass(property);
                break;
            case DescValueType.UNITDOUBLE:
                return (desc.getUnitDoubleValue(property));
                break;
            case DescValueType.ENUMERATEDTYPE:
                return (t2s(desc.getEnumerationValue(property)));
                break;
            case DescValueType.RAWTYPE:
                var tempStr = desc.getData(property);
                var rawData = new Array();
                for (var tempi = 0; tempi < tempStr.length; tempi++) {
                    rawData[tempi] = tempStr.charCodeAt(tempi);
                }
                return rawData;
                break;
            default:
                break;
        };
    }

    function s2t(s) { return stringIDToTypeID(s) }
    function t2s(t) { return typeIDToStringID(t) }
}

 

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

Myra Ferguson
Braniac
January 14, 2024

If you look at the top of the Layers panel, you'll see a dropdown menu for Kind. You can filter your layers in a variety of ways. If you have different types of layers that you might want to select at the same time, then you could label them with a color, use Kind to filter by color and set the color to the one that is used for these layers. To add a color label to a layer, right-click to the right of the layer name to display the contextual menu. At the bottom, you'll see the colors that you can apply as a label (including No Color). When the layers are filtered to show a particular kind, then you can use Select > All Layers to select all of the layers currently filtered. Photoshop won't select the ones that aren't showing because of the filter.

Braniac
January 14, 2024
quote

If you look at the top of the Layers panel, you'll see a dropdown menu for Kind. You can filter your layers in a variety of ways. If you have different types of layers that you might want to select at the same time, then you could label them with a color, use Kind to filter by color and set the color to the one that is used for these layers. To add a color label to a layer, right-click to the right of the layer name to display the contextual menu. At the bottom, you'll see the colors that you can apply as a label (including No Color). When the layers are filtered to show a particular kind, then you can use Select > All Layers to select all of the layers currently filtered. Photoshop won't select the ones that aren't showing because of the filter.


By @Myra Ferguson

 

As far as I remember, several types can be specified in the filter at the same time.
 
 
 
Myra Ferguson
Braniac
January 14, 2024

If it helps, here are the kinds of layers that you can select:

 

Assigning a color label is helpful way to specify certain layers--especially if you have other layers of the same kind that you don't want selected.