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

Script for adding file name to Headline field in metadata

New Here ,
Oct 28, 2024 Oct 28, 2024

I've found scripts for adding file name to Title and file name to Decription fields but I need one to add file name to Headline field. I've tried modifying those other scripts to work for the Headline but I can't get it to work. Seems like the Headline field is blocked from having data added to it.

TOPICS
How to , Metadata , Scripting
215
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 ,
Oct 28, 2024 Oct 28, 2024

@Josh32154076x9ig 

 

 

// https://forums.adobe.com/thread/656144  
// https://forums.adobe.com/message/9744916  
// https://forums.adobe.com/message/9745231  
#target bridge  
addNametoMeta = {};  
addNametoMeta.execute = function(){  
  var sels = app.document.selections;  
  for (var i = 0; i < sels.length; i++){  
var md = sels[i].synchronousMetadata;  
    md.namespace = "http://ns.adobe.com/photoshop/1.0/";  
    var Name = decodeURI(sels[i].name).replace(/\.[^\.]+$/g, ' '); //remove extension   
    md.Headline = md.Headline + Name;  
  }  
}  
if (BridgeTalk.appName == "bridge"){  
var menu = MenuElement.create( "command", "Filename to XMP and IPTC Headline", "at the end of Tools");  
  menu.onSelect = addNametoMeta.execute;  
} 

 

Or:

 

#target bridge

addTitleToHeadline = {};

addTitleToHeadline.execute = function () {
    var sels = app.document.selections;
    for (var i = 0; i < sels.length; i++) {
        var md = sels[i].synchronousMetadata;
        md.namespace = "http://ns.adobe.com/photoshop/1.0/";
        var Name = decodeURI(sels[i].name).replace(/\.[^\.]+$/g, ' '); //remove extension
        md.Headline = Name;
    }
}

if (BridgeTalk.appName == "bridge") {
    var menu = MenuElement.create("command", "Add Filename to Headline", "at the end of Tools");
    menu.onSelect = addTitleToHeadline.execute;
}

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

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 ,
Oct 28, 2024 Oct 28, 2024
quote

I've found scripts for adding file name to Title and file name to Decription fields but I need one to add file name to Headline field. I've tried modifying those other scripts to work for the Headline but I can't get it to work. Seems like the Headline field is blocked from having data added to it.


By @Josh32154076x9ig

 

You need to target the appropriate namespace for the different metadata entries...

 

Headline = http://ns.adobe.com/photoshop/1.0/ 

 

Title = http://purl.org/dc/elements/1.1/ 

 

It also depends on whether one is writing to the legacy IPTC or current XMP metadata.

 

In short, it's a minefield!

 

 

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 ,
Oct 28, 2024 Oct 28, 2024
LATEST

Hi Stephen, Thank you so much for the quick and accurate reply. I just tried the script and it works great!

I also appreciate you showing how it functions, there's a lot going on in the metadata mine fields.

Thanks again!

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