Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Core infoset badge object

LEGEND ,
Aug 15, 2018 Aug 15, 2018

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.synchronousMetadata;

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

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

//~                 if(thumbs.core.quickMetadata.hasRawSettings){

//~                     alert('True');

//~                     }

//~                 alert(num);

                if(num > 0){

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

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

//~                     var bArray = thumbs.core.badges.badges;

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

//~                     bArray.push(bObj);

                    }

                }

            }

        }

    catch(e){

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

        }

    }

TOPICS
Scripting
357
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation