Skip to main content
Participant
March 8, 2023
Open for Voting

Colour tag / search Layer comps - Photoshop

  • March 8, 2023
  • 5 replies
  • 289 views

I have files for clients, which contain tons of variations of an image, artowkr layer, colour variations etc

Searcing through 70 layer comps is painful and boring.

 

The ability to better organise layer comps with colour labels, folders, search fields etc .. as per the action and layers panels would be great!

 

5 replies

Stephen Marsh
Community Expert
Community Expert
March 9, 2023

I'm still trying to work out how to make the search case-insensitive or partial matching (there would of course be limitations if a full or partial match occurs for two or more entries).

 

EDIT: If required, I have only been able to make the search case insensitive by converting the string to lowercase (or uppercase, which makes less sense as it takes more work). Both scripts have been updated to include full or partial matching.

 

@Ian26310128ux30 – Please let me know how you go!

Stephen Marsh
Community Expert
Community Expert
March 9, 2023

The following variation on the previous script will search for a case-sensitive, full or partial matching comment (rather than name):

 

EDIT: Script updated to 1.1 version!

 

/*
Find Layer Comp By Comment Prompt.jsx
v1.1, 9th March 2023, Stephen Marsh
https://community.adobe.com/t5/photoshop-ecosystem-ideas/colour-tag-search-layer-comps-photoshop/idc-p/13636551
*/

#target photoshop

    (function () {

        var doc = activeDocument;

        // Prompt for the comp comment
        layerCompComment = prompt("Find Layer Comp By Comment: \r (Case Sensitive, Full or Partial Match Required)", "");
        if (layerCompComment === null) {
            //alert('Script cancelled!');
            return
        }

        // Check if the current document has any layer comps
        if (doc.layerComps.length === 0) {
            alert("The doc doesn't have any layer comps!");
        } else {
            var layerComp = null;

            // Loop over all the layer comps and search for the comment entered into the prompt
            for (var i = 0; i < doc.layerComps.length; i++) {
                // Full case sensitive match on comment
                //if (doc.layerComps[i].comment === layerCompComment) {
                // Partial or full case sensitive match on name
                if (doc.layerComps[i].comment.indexOf(layerCompComment) !== -1) {
                    layerComp = doc.layerComps[i];
                    break;
                }
            }

            // Check if a layer comp with the entered comment was found
            if (layerComp === null) {
                alert("No layer comp with the comment '" + layerCompComment + "' was found.");
            } else {
                layerComp.apply();
                alert("Layer comp comment '" + layerCompComment + "' found and selected!");
            }
        }

    })();

 

 

Stephen Marsh
Community Expert
Community Expert
March 9, 2023

OK, here is a script that will let you search for a layer comp with a case-sensitive, partial or full name match:

 

 

EDIT: Script updated to 1.1 version!

 

/*
Find Layer Comp By Name Prompt.jsx
v1.1, 9th March 2023, Stephen Marsh
https://community.adobe.com/t5/photoshop-ecosystem-ideas/colour-tag-search-layer-comps-photoshop/idc-p/13636551
*/

#target photoshop

    (function () {

        var doc = activeDocument;

        // Prompt for the comp name
        layerCompName = prompt("Find Layer Comp By Name: \r (Case Sensitive, Full or Partial Match Required)", "");
        if (layerCompName === null) {
            //alert('Script cancelled!');
            return
        }

        // Check if the current document has any layer comps
        if (doc.layerComps.length === 0) {
            alert("The doc doesn't have any layer comps!");
        } else {
            var layerComp = null;

            // Loop over all the layer comps and search for the name entered into the prompt
            for (var i = 0; i < doc.layerComps.length; i++) {
                // Full case sensitive match on name
                //if (doc.layerComps[i].name === layerCompName) {
                // Partial or full case sensitive match on name
                if (doc.layerComps[i].name.indexOf(layerCompName) !== -1) {
                    layerComp = doc.layerComps[i];
                    break;
                }
            }

            // Check if a layer comp with the entered name was found
            if (layerComp === null) {
                alert("No layer comp with the name '" + layerCompName + "' was found.");
            } else {
                layerComp.apply();
                alert("Layer comp name '" + layerCompName + "' found and selected!");
            }
        }

    })();

 

  1. Copy the code text to the clipboard
  2. Open a new blank file in a plain-text editor (not in a word processor)
  3. Paste the code in
  4. Save as a plain text format file – .txt
  5. Rename the saved file extension from .txt to .jsx
  6. Install or browse to the .jsx file to run (see below)

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

Stephen Marsh
Community Expert
Community Expert
March 9, 2023

Looking at the scripting properties and methods, there sadly doesn't appear to be much that can be done (by me)... It might be possible to search for a keyword in the comp name though, I'll see what I can come up with.

 

Of course, it is possible to create GUI-based scripts, extensions or UXP paenels etc. for extra functionality beyond the native panel.

Stephen Marsh
Community Expert
Community Expert
March 8, 2023

I have voted. Perhaps a script could do something, I'll take a look for you tomorrow.