I would greatly appreciate that. Thank you,
This should work. Save as PLAIN TEXT with .jsx extension and copy into the Bridge Startup Scripts folder. Restart Bridge, select your files, right-click "Ratio to Description".
/*
Utility Pack Scripts created by David M. Converse ©2018-23
This script writes dims to description
Last modified 3/9/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'){
var ratioCmd = MenuElement.create('command', 'Ratio to Description', 'after Thumbnail/Open', this.menuID); //add to Contextual menu
}
ratioCmd.onSelect = function(){
ratioMain();
}
ratioMain = function(){
var descThumbs = app.document.selections; //get selected thumbnails
var dims = '';
var h = 0;
var w = 0;
if(ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
if(!descThumbs.length) return; //nothing selected
for(var a in descThumbs){ //loop through thumbs
if(!descThumbs[a].container){
try{
var descMeta = descThumbs[a].synchronousMetadata;
var descXMP = new XMPMeta(descMeta.serialize());
descXMP.deleteProperty(XMPConst.NS_DC, 'description');
h = descThumbs[a].core.quickMetadata.height;
w = descThumbs[a].core.quickMetadata.width;
if(h > w){
dims = '3\"H x ' + (w/h*3).toString() + '\"W';
}
else{
dims = (h/w*3).toString() +'\"H x ' + '3\"W';
}
descXMP.setLocalizedText(XMPConst.NS_DC, 'description', null, 'x-default', dims);
var descUpdatedPacket = descXMP.serialize(XMPConst.SERIALIZE_OMIT_PACKET_WRAPPER | XMPConst.SERIALIZE_USE_COMPACT_FORMAT);
descThumbs[a].metadata = new Metadata(descUpdatedPacket); //write to file
}
catch(e){
alert(e + e.line);
}
}
}
}