Copy link to clipboard
Copied
Displaying metadata for multiple files can be difficult or impossible in thumbnail or list view modes. This is a demo script to show metadata in a floating window, using a listbox control.
You could easily swap out other metadata values as needed by editing the source code. I wrote this specifically for my use which is why I used Description and Copyright.
Save this script as PLAIN TEXT with a ".jsx" file extension and put into your Bridge Scripts folder. Restart Bridge and it should show up.
------EDIT------
Added a Copy button and multiselect, so you can select multiple lines and copy the contents to the system Clipboard.
/*
Utility Pack Scripts created by David M. Converse ©2018-23
This demo script creates a floating Bridge window showing file info in a listbox
Last modified 12/13/2023
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#target bridge
if(BridgeTalk.appName == 'bridge'){
try{
var infoCmd = MenuElement.create('command', 'File Info', 'at the end of Tools'); //create new menu command
infoCmd.onSelect = function(){
infoMain();
}
function infoMain(){
if(ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript'); //load XMP library
var infoWindow = new Window('palette', 'Info', undefined, {closeButton:true, resizeable:true}); //floating window
var Sdesc = '';
var Sdate = ''; //copyright
var Litems = []; //listbox line items
var SMeta = null; //metadata
var SXMP = null; //XMP object
infoWindow.alignChildren = ['left', 'top'];
infoWindow.orientation = 'column';
infoWindow.Grp0 = infoWindow.add('group', undefined, '');
infoWindow.Grp0.orientation = 'row';
infoWindow.Grp0.alignChildren = ['left', 'top'];
infoWindow.Grp0.margins = [15, 0, 15, 0];
infoWindow.Grp0.preferredSize = [1000, 60];
infoWindow.Grp0.button1 = infoWindow.Grp0.add('button', undefined, 'Refresh');
infoWindow.Grp0.button1.preferredSize = [60, 25];
infoWindow.Grp0.button1.indent = 15;
infoWindow.Grp0.button2 = infoWindow.Grp0.add('button', undefined, 'Copy');
infoWindow.Grp0.button2.preferredSize = [60, 25];
infoWindow.Grp0.button2.indent = 15;
infoWindow.Grp1 = infoWindow.add('group', undefined, '');
infoWindow.Grp1.orientation = 'column';
infoWindow.Grp1.alignChildren = ['fill', 'top'];
infoWindow.Grp1.margins = [15, 0, 15, 0];
infoWindow.Grp1.preferredSize = [1000, 800];
//create listbox with columns
infoWindow.Grp1.lbox1 = infoWindow.Grp1.add('listbox', undefined, undefined, {numberOfColumns:3, showHeaders:true, multiselect:true, columnWidths:[250, 300, 250], columnTitles:['Filename', 'Description', 'Copyright']});
infoWindow.Grp1.lbox1.preferredSize = [900, 700];
infoWindow.Grp1.lbox1.add('item', ''); //add dummy item
infoWindow.Grp1.lbox1.show();
infoWindow.Grp0.button1.onClick = function(){ //load listbox
sels = app.document.selections; //Bridge selections
infoWindow.Grp1.lbox1.removeAll(); //clear previous
for(var i = 0; i < sels.length; i++){ //loop through selected thumbs
if(sels[i].hasMetadata){ //skip anything without metadata
SMeta = sels[i].synchronousMetadata; //get metadata
SXMP = new XMPMeta(SMeta.serialize()); //create object
Sname = sels[i].name; //filename
Sdesc = SXMP.getLocalizedText(XMPConst.NS_DC, 'description', null, 'x-default'); //get description
Sdate = sels[i].metadata.read(XMPConst.NS_DC, 'rights'); //get copyright
Litems[i] = infoWindow.Grp1.lbox1.add('item', Sname); //add variables to listbox
Litems[i].subItems[0].text = Sdesc; //column 2
Litems[i].subItems[1].text = Sdate; //column 3
}
}
}
infoWindow.Grp0.button2.onClick = function(){
try{
var j = [];
j = infoWindow.Grp1.lbox1.selection;
if(j == null){
return;
}
if(app.version >= 13){
var Stext = '';
for(var k = 0; k < j.length; k++){
Stext = Stext + j[k].text + '\t' + j[k].subItems[0].text + '\t' + j[k].subItems[1].text + '\r';
}
Stext = Stext.substr(0, (Stext.length - 1)); //remove trailing return
app.document.copyTextToClipboard(Stext);
}
else{
if(Folder.fs == 'Windows'){ //Windows
var testWindow = new Window('palette', '', undefined); //create invisible window to copy from
testWindow.txt_1 = testWindow.add('edittext', undefined, '');
testWindow.layout.layout(true);
testWindow.opacity = 0;
testWindow.show();
for(var k = 0; k < j.length; k++){
testWindow.txt_1.text = testWindow.txt_1.text + j[k].text + '\t' + j[k].subItems[0].text + '\t' + j[k].subItems[1].text + '\r';
}
testWindow.txt_1.text = testWindow.txt_1.text.substr(0, (testWindow.txt_1.text.length - 1)); //remove trailing return
testWindow.txt_1.active = true;
app.document.chooseMenuItem('mondo/command/selectAll');
app.document.chooseMenuItem('mondo/command/copy');
testWindow.close();
}
else{ //Mac
var Stext = '';
for(var k = 0; k < j.length; k++){
Stext = Stext + j[k].text + '\t' + j[k].subItems[0].text + '\t' + j[k].subItems[1].text + '\r';
}
Stext= Stext.substr(0, (Stext.length - 1)); //remove trailing return
app.system('echo "' + Stext + '" | pbcopy');
}
}
}
catch(e){
alert(e + e.line);
}
}
infoWindow.layout.layout(true);
infoWindow.show(); //lay out and display window
}
}
catch(e){
alert(e + ' ' + e.line);
}
}
Copy link to clipboard
Copied
Updated 12/13/23