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

Filename to IPTC Title, but without extension. (Currently using DAM script)

New Here ,
Nov 19, 2011 Nov 19, 2011

Hello,

Apologies if this isn't the correct forum to ask this question:

I am currently using the DAM Filename to Title script with Bridge CS4 - http://www.damuseful.com/pages/PimpMyBridge.html - to get the filename into the IPTC title script. This however puts in the extension into the title field also. So a JPG file named 2000 ends up with 2000.JPG in its Title field. I wish to not have the extension appear in the Title field.

Is this possible by modifying the DAM script / using any other freely available script.

In case it helps, this is what the DAM script currently looks like:

#target bridge

if ( BridgeTalk.appName = "bridge" )

//-----------------------------------------------------------------------

//This script copies selected thumbnails' filenames to the title field

//Also shows how to add menu items

//The AdobeLibrary scripts must be loaded

//This script was created by John Beardsworth www.beardsworth.co.uk/ and modified by Peter Krogh www.DAMuseful.com

//This script may be freely distributed and modified

//--------------------------------------------------------------------

// Let's create our menu

    var menu = MenuElement.create( "command", "Write Filename to IPTC Title Field", "at the end of Tools");

    menu.onSelect = function(m)

{

var getFolderChildren = true ;

var filesOnly = true ;

var thumbs = getBridgeThumbnails ( TYPES.PHOTOSHOP_OPENABLE, getFolderChildren, filesOnly) ;

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

{ thumb = thumbs;

   md = thumb.synchronousMetadata;

   md.namespace ="http://ns.adobe.com/photoshop/1.0/";

   md.Title = thumb.name;

  

}

   Window.alert ("Done " + i + " records");

};

There are also 3 other Adobe Library scripts that come with the download.

I know absolutely nothing about scripting, so baby-steps would be appreciated.

Many thanks.

TOPICS
Scripting
3.3K
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

correct answers 1 Correct answer

Valorous Hero , Nov 20, 2011 Nov 20, 2011

Change:

md.Title = thumb.name;

To:

md.Title = decodeURI(thumb.name).replace(/\.[^\.]+$/, '');

Translate
Valorous Hero ,
Nov 20, 2011 Nov 20, 2011

Change:

md.Title = thumb.name;

To:

md.Title = decodeURI(thumb.name).replace(/\.[^\.]+$/, '');

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
New Here ,
Nov 22, 2011 Nov 22, 2011

Thanks Paul, this works beautifully

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
Community Expert ,
Dec 13, 2016 Dec 13, 2016

I'll add my thanks as well. Works in Bridge CC 2017.

Gene

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
Community Beginner ,
Jan 31, 2019 Jan 31, 2019

Any idea how to modify this for writing to a .wav file?

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
LEGEND ,
Feb 01, 2019 Feb 01, 2019
LATEST

Can a WAV file store metadata? If so, it would use the same process.

I use a slightly different script, there are multiple ways to get a list of files, multiple ways to remove parts of the name, and multiple ways to write metadata back to files:

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

#target bridge

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

    FT = MenuElement.create("command", "Add Part Number to Title", "at the end of Tools");

    }

FT.onSelect = function (){

    AddFilenameToTitle();

    }

function AddFilenameToTitle(){

    var thumbs = app.document.selections;

    if(!thumbs.length) return;

    if(ExternalObject.AdobeXMPScript == undefined)  ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");

    for(var a in thumbs){

        var selectedFile = thumbs.spec;

        var Title = selectedFile.name;

        Title = Title.split('.');

        if(Title.length > 1){

            Title.length--;

            }

        Title = Title.join('.');

        var md = thumbs.synchronousMetadata;

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

        xmp.deleteProperty(XMPConst.NS_DC, "title");

        xmp.appendArrayItem(XMPConst.NS_DC, "title", Title, 0, XMPConst.ALIAS_TO_ALT_TEXT);

        xmp.setQualifier(XMPConst.NS_DC, "title[1]", "http://www.w3.org/XML/1998/namespace", "lang", "x-default");

        var updatedPacket = xmp.serialize(XMPConst.SERIALIZE_OMIT_PACKET_WRAPPER | XMPConst.SERIALIZE_USE_COMPACT_FORMAT);

        thumbs.metadata = new Metadata(updatedPacket);

        }

    }

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

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