Bridge: Badge core infoset object

  • 1
  • Question
  • Updated 3 months ago
Ok this is an obscure question, sorry :)

I'm trying to figure out how to add a badge to a thumbnail in the content panel. SHOULD be straightforward, but I get a type:undefined error for lines 46 and 47.

I've tried pushing values onto the array, nothing happens. I'm able to read a different core infoset property ok (commented out.) Any ideas?

The badge code fires if the files have saved Camera RAW snapshots.

Sample code:

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

#target bridge

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

    var newCommand = new MenuElement('command', 'Snapshots', '');

    }

newCommand.onSelect = function (){

    snaps();

    }

function snaps(){

    try{

        if(xmpLib == undefined){

            if(Folder.fs == 'Windows'){

                var pathToLib = Folder.startup.fsName + '/AdobeXMPScript.dll';

                }

            else{

                var pathToLib = Folder.startup.fsName + '/AdobeXMPScript.framework';

                }

            var libfile = new File(pathToLib);

            var xmpLib = new ExternalObject('lib:' + pathToLib);

            }

        assignBadge();

        }

    catch(e){

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

        }

    }

function assignBadge(){

    try{

        if(app.document.selectionLength > 0){

            thumbs = app.document.getSelection('NEF, CR2, ARW');

            }

        if(thumbs.length > 0){

            var myBadge = new BitmapData(24, 24, true, '#ff00ff');

            for (var i = 0; i < thumbs.length; i++){

                var md = thumbs[i].synchronousMetadata;

                var xmp = new XMPMeta(md.serialize());

                var num = xmp.countArrayItems("http://ns.adobe.com/camera-raw-saved-settings/1.0/", 'SavedSettings');

//~                 if(thumbs[i].core.quickMetadata.hasRawSettings){

//~                     alert('True');

//~                     }

//~                 alert(num);

                if(num > 0){

                    thumbs[i].core.badges.badges[0].badge = myBadge;

                    thumbs[i].core.badges.badges[0].toolTip = 'test';

//~                     var bArray = thumbs[i].core.badges.badges;

//~                     var bObj = {badge:myBadge, toolTip:'test'};

//~                     bArray.push(bObj);

                    }

                }

            }

        }

    catch(e){

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

        }

    }



Photo of David Converse

David Converse

  • 438 Posts
  • 119 Reply Likes
  • in over my head

Posted 3 months ago

  • 1
Photo of Todd Shaner

Todd Shaner, Champion

  • 1106 Posts
  • 357 Reply Likes
You're more likely to get a reply by posting this question in the Bridge Scripting forum:

https://forums.adobe.com/community/bridge/bridge_scripting

Photo of Kukurykus

Kukurykus

  • 611 Posts
  • 137 Reply Likes
He did that as well right after posting it on here: https://forums.adobe.com/thread/2524653