Skip to main content
Participating Frequently
February 9, 2019
Question

Can Bridge show me what collections an image is in?

  • February 9, 2019
  • 2 replies
  • 3003 views

In Bridge CC 2019 I use collections to track track various workflow states, such as which sites I have uploaded an image to.

Thus a single image may be in multiple collections - but I can't see how to determine which collections an image is in. (Other than browsing every collection which would be tedious). Am I missing something?

Ideally I would like the equivalent to the function that is in Photoshop Elements, where a right click on a image gives an option to "Remove from Album" and it shows the albums the image can be removed from.

    This topic has been closed for replies.

    2 replies

    Legend
    February 11, 2019

    Save this script as a ".jsx" file and put it in your Bridge Startup Scripts folder (Preferences->Startup Scripts and click the reveal button.) Relaunch Bridge, select ONE file, and select the command from the Tools menu.

    This will search your collections and show a dialog listing which ones that file is in. Bridge apparently cannot search Smart Collections, not sure if that's a bug or what.

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

    #target bridge

    if(BridgeTalk.appName == 'bridge'){

        var newCommand = new MenuElement('command', 'Find in Collections...', 'at the end of Tools');

        }

    newCommand.onSelect = function (){

        collFind();

        }

    function collFind(){

        var foundColl = '';

        var j = 0;

        var k = 0;

        try{

            app.synchronousMode = true;

            if(app.document.selectionsLength != 1){

                alert('Please select one file to search for in Collections.');

                return(false);

                }

            else{

                var sFile = app.document.selections;

                var CollList = app.getCollections();

                var sCollList = app.getSmartCollections();

                for(j=0;j < CollList.length; j++){

                    if(app.isCollectionMember(CollList, sFile[0])){

                        foundColl = foundColl + '\r' + CollList.name;

                        }

                    }

                if(foundColl == ''){

                    alert(sFile.name + ' is not in any Collections');

                    return(true);

                    }

                else{

                    alert(foundColl);

                    }

                }

            app.synchronousMode = false;

            }

        catch(e){

            alert(e + '   ' + e.line);

            return;

            }

        }

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

    Participating Frequently
    February 11, 2019

    Thanks. That script is helpful for me.

    I also submitted a Bridge feature request to have the equivalent of the PSE option to Remove from Album.

    Legend
    February 11, 2019

    Try this instead.

    #target bridge

    if(BridgeTalk.appName == 'bridge'){

        var FM = new MenuElement('command', 'Find in Collections...', 'at the end of Tools');

        var FC = new MenuElement('command', 'Find in Collections...', 'after Thumbnail/Open', this.menuID);

        }

    FM.onSelect = function (){

        collFind();

        }

    FC.onSelect = function(){

            collFind();

        }

    function collFind(){

        var foundColl = [];

        var j = 0;

        var k = 0;

        try{

            app.synchronousMode = true;

            if(app.document.selectionsLength != 1){

                alert('Please select one file to search for in Collections.');

                return(false);

                }

            else{

                var sFile = app.document.selections;

                var CollList = app.getCollections();

                var sCollList = app.getSmartCollections();

                for(j=0;j < CollList.length; j++){

                    if(app.isCollectionMember(CollList, sFile[0])){

                        foundColl = CollList;

                        k++;

                        }

                    }

                if(foundColl == ''){

                    alert(sFile[0].name + ' is not in any collections');

                    return(true);

                    }

                else{

                    var w = new Window('palette', 'Find in Collections', undefined, {closeButton:true});

                    w.preferredSize = [350, 350];

                    g = w.add('group', undefined, '');

                    g.orientation = 'column';

                    g.preferredSize = [300, 150];

                    g.alignChildren = ['fill', 'fill'];

                    s = g.add('statictext', undefined, '', {multiline: true});

                    lb = g.add('listbox', undefined, '', {multiselect:true});

                    lb.preferredSize = [250, 125];

                    for(j=0;j < foundColl.length; j++){

                        lb.add('item', foundColl.name);

                        }

                    g2 = w.add('group', undefined, '');

                    g2.orientation = 'row';

                    g2.preferredSize = [300, 150];

                    g2.alignChildren = ['fill', 'fill'];

                    br = g2.add('button', undefined, 'Remove');

                    b = g2.add('button', undefined, 'Close');

                    s.text = sFile[0].name + ' is in the following collections:\r\r\

                    Select collection(s) and click Remove button to remove ' + sFile[0].name + ' from collection(s).';

                    g.layout.layout(true);

                    g2.layout.layout(true);

                    w.layout.layout(true);

                    w.show();

                    b.onClick = function(){

                        w.close();

                        }

                    br.onClick = function(){

                        var m = 'Remove ' + sFile[0].name + ' from Collections?';

                            if(confirm(m)){

                                for(var a in lb.selection){

                                    app.removeCollectionMember(foundColl, sFile[0]);

                                    lb.remove(lb.selection);

                                }

                            }

                        }

                    }

                }

            app.synchronousMode = false;

            }

        catch(e){

            alert(e + '   ' + e.line);

            return;

            }

        }

    Stephen Marsh
    Community Expert
    Community Expert
    February 10, 2019

    I am not aware of a method within Bridge.

    Knowing that collections are actually XML plain text files with a .filelist extension and where they are located, one can use a tool that can search the content of the files for a specific image name. In the screenshot below, I have used TextWrangler/BBEdit on the Mac OS:

    Legend
    February 11, 2019

    BBEdit on Mac, Notepad++ on Windows. Do a multi-file search in the Collections folder.