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

Looking for a Script for Bridge..

New Here ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

Can anyone direct me where to build a script for Bridge.

 

I would like to build a script to convert the Dimensions (in inches) metadata to the dimensions if the the size was reduced to 3" on the largest side and put it in the description metadate line.

 

 

TOPICS
How to , Metadata

Views

473

Translate

Translate

Report

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

correct answers 1 Correct answer

LEGEND , Mar 09, 2023 Mar 09, 2023

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

Votes

Translate

Translate
LEGEND ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

This can certainly be done, but be aware that images are measured in pixels and inches are a derived property. If PPI data is changed or deleted, the derived inch measurement will also change.

Votes

Translate

Translate

Report

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
New Here ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

Thank you for the heads up.  Would it be possible to have the script over write itself up request?

Votes

Translate

Translate

Report

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
LEGEND ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

I'm not sure what you are asking, sorry.

Votes

Translate

Translate

Report

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
New Here ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

Oh, its likely due to my lack of knowledge on the subject.  I don't even know how to explain it properly.  I was simply confirming that, I could potentially be able to run the script again and replace the description again with the updated size as it would be based off the pixel data.

 

More so, is there somewhere where to start for the novice such as myself?

Votes

Translate

Translate

Report

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
LEGEND ,
Mar 09, 2023 Mar 09, 2023

Copy link to clipboard

Copied

Yes you can change metadata at any time.

I already have a script that writes to the description, I'll post it here when I get time. Shouldn't be hard to modify.

Votes

Translate

Translate

Report

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
New Here ,
Mar 09, 2023 Mar 09, 2023

Copy link to clipboard

Copied

I would greatly appreciate that.  Thank you,

Votes

Translate

Translate

Report

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
LEGEND ,
Mar 09, 2023 Mar 09, 2023

Copy link to clipboard

Copied

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);
                }
            }
        }
    }

 

Votes

Translate

Translate

Report

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
New Here ,
Mar 09, 2023 Mar 09, 2023

Copy link to clipboard

Copied

First, thank you.  

 

I am however running into a bit of a bug and maybe you can help.  I've followed you instructions (to the best of my ability at least) and have tried to run the script.  I receive the following error code.  Easier to screen shot, but I can write it if you'd like.

Votes

Translate

Translate

Report

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
New Here ,
Mar 09, 2023 Mar 09, 2023

Copy link to clipboard

Copied

ReferenceError:  XMPMeta does not have a constructor37

Votes

Translate

Translate

Report

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
LEGEND ,
Mar 09, 2023 Mar 09, 2023

Copy link to clipboard

Copied

Ah yeah there is a library that has to be loaded, I updated the script above.

Votes

Translate

Translate

Report

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
New Here ,
Mar 09, 2023 Mar 09, 2023

Copy link to clipboard

Copied

LATEST

Thank you, it works perfectly.

Votes

Translate

Translate

Report

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