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

new XMP meta Data Field in InDesign through Javascript

Participant ,
Dec 07, 2021 Dec 07, 2021

Copy link to clipboard

Copied

Hi,

I would like to add a new XMP metadata field in indesign (see below snapshot).

Screenshot 2021-12-07 at 8.12.50 PM.png).

 

Can you please guide me how to create this field via JavaScript.

 

TOPICS
Scripting

Views

750

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
Community Expert ,
Dec 30, 2021 Dec 30, 2021

Copy link to clipboard

Copied

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
Engaged ,
Dec 30, 2021 Dec 30, 2021

Copy link to clipboard

Copied

Hi @Asuvath ,

 

Here is the sample code, you need to update values.

var myDoc = app.documents[0];
myDoc.metadataPreferences.properties = {
    author: "",
    copyrightInfoURL: "",
    copyrightNotice: "",
    copyrightStatus: "",
    description: "",
    documentTitle: "",
    jobName: "",
    keywords: ["", "",]

};

 

-Sumit

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
Participant ,
Jun 08, 2022 Jun 08, 2022

Copy link to clipboard

Copied

Hi Sumit,

Thanks for the response. Sorry for the late replies. Actually my request is to create the new field under meta data. 
Your code will be update the information in default meta data fields (Autor, title, etc.).
Is there any possible way to create the new meta data field?

Thanks
Asuvath

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
Community Expert ,
Jun 09, 2022 Jun 09, 2022

Copy link to clipboard

Copied

Not sure if this helps, but you can also get metadata, so you could display a Raw property in a dialog like this:

 

var md = app.activeDocument.metadataPreferences;
var ns = "http://ns.adobe.com/xap/1.0/"
var p = "Name"
alert("This Document’s " + p +" property is set to: " + md.getProperty(ns, p))

 

Screen Shot 1.png

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
Community Expert ,
Jun 08, 2022 Jun 08, 2022

Copy link to clipboard

Copied

Hi @Asuvath , You can customize the Raw Data to include property value pairs:

 

 

var md = app.activeDocument.metadataPreferences;
var ns = "http://ns.adobe.com/xap/1.0/";
md.setProperty(ns, "Name", "John Doe")

 

 

 

Screen Shot 45.png

 

 

Here’s an example that loops thru an object:

 

 

var md = app.activeDocument.metadataPreferences;
var ns = "http://ns.adobe.com/xap/1.0/";
var p, v;

//a json object
var o = {"Name":"John Doe","id":"1234","Address":"Main Street"}
var props = o.reflect.properties;

for (var i = 0; i < props.length-4; i++){
    p = props[i].name
    v = o[props[i]]
    md.setProperty(ns, p, v)
};   

 

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
Participant ,
Jun 09, 2022 Jun 09, 2022

Copy link to clipboard

Copied

Hi @rob day ,
Thanks for the response. Is there any way to create the new label under "Raw Data" with some text field as shown in my screenshot?

Screenshot 2022-06-09 at 9.29.53 PM.png


So the user may know visibly even if there are do not know about the XMP coding.

Thanks

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
Community Expert ,
Jun 09, 2022 Jun 09, 2022

Copy link to clipboard

Copied

I don‘t think there is a way to alter the File Info UI via Javascript. You must be running a third party extension to get the Relay item?

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
Engaged ,
Jun 16, 2022 Jun 16, 2022

Copy link to clipboard

Copied

LATEST

I think you need to create your own custom UI and then link your own created UI to indesign default UI.

SampleSample

 

-Sumit

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