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

Indesign filename into the meta data automatically

Community Beginner ,
Mar 27, 2015 Mar 27, 2015

Copy link to clipboard

Copied

I'd like to be able to add the indesign filename into the meta data xmp (File info/Document Title) automatically on all the documents we work on. The reason being our client changes the file name on the pdf's we send and when they return the pdf to us for amends I have little or no way of locating the file amongst 25,000 documents.

TOPICS
Scripting

Views

3.9K

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 Beginner ,
Mar 30, 2015 Mar 30, 2015

Copy link to clipboard

Copied

Copy the text between the two lines below.

Paste it into a text editor and save the file as "storeTitleXMP.jsx"

In this folder:

/Applications/Adobe InDesign CC 2014/Scripts/startup scripts/

This script will load at startup of InDesign and will run just before each time the file is saved.

When you view the RAW XML you will see the following listed within the document XMP:

"        <xmp:LCCDocumentStatus>In Progress</xmp:LCCDocumentStatus>

         <xmp:LCCUserName>jhaney</xmp:LCCUserName>

         <xmp:LCCRevisionNotes>More edits</xmp:LCCRevisionNotes>

         <xmp:InDesignFileName>Untitled-7 copy.indd</xmp:InDesignFileName>

         <xmp:CreatorTool>Adobe InDesign CC 2014 (Macintosh)</xmp:CreatorTool>

"

script begins below line

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

#targetengine 'session'

var myEventListener = app.addEventListener("beforeSave", function (myEvent) {

var doc = app.documents[0];

var docTitle = (doc.name);

var myDocXMP = app.activeDocument.metadataPreferences;

var destNamespace = "http://ns.adobe.com/xap/1.0/";

var destNodeName = "InDesignFileName";

var nodeValue = docTitle;

myDocXMP.setProperty(destNamespace, destNodeName, nodeValue);

}

).name = "storeTitleXMP";

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

script ends above line

Hope this gives you what you need.

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 Beginner ,
Mar 30, 2015 Mar 30, 2015

Copy link to clipboard

Copied

To access the extended metadata in Acrobat:

Open file

Choose menu "Properties"

with the "Description" tab selected

Click on the button named "Additional Metadata..."

Click on "Advanced"

Click the triangle next to "XMP Core Properties..."

Your custom field will be listed in the fields presented under this 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
Community Beginner ,
Mar 31, 2015 Mar 31, 2015

Copy link to clipboard

Copied

Hi James,

If this work it will save me hours of work!! I have tried to load the scrip but I’m getting the below error message in Indesign – what do you think? Sorry to as the question but I know nothing about scripting.

Thanks

Paul

Screen Grab.jpg

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
People's Champ ,
Mar 31, 2015 Mar 31, 2015

Copy link to clipboard

Copied

Hi,

What about this :

#targetengine "onBeforeOpenAndNew"

function main() {

  //Referencing events

  var onAfterOpenEvent = app.eventListeners.item("onAfterOpen");

  var onAfterNewEvent = app.eventListeners.item("onAfterNew");

  var onAfterSaveEvent = app.eventListeners.item("onAfterSave");

  var onAfterSaveAsEvent = app.eventListeners.item("onAfterSaveAs");

  //Adding name to description

  var f = function(evt){

  var doc = evt.target;

  if ( !(doc instanceof Document) ) return;

  var m = doc.metadataPreferences.documentTitle;

  var dn = doc.name;

  ( m=="" ||  m!=dn ) && doc.metadataPreferences.documentTitle = dn;

  }

  //Adding listeners only is not declared yet

  !onBeforeOpenEvent.isValid && app.eventListeners.add( "afterOpen", f ).name = "onAfterOpen";

  !onBeforeNewEvent.isValid && app.eventListeners.add( "afterNew", f ).name = "onAfterNew";

  !onAfterSaveEvent.isValid && app.eventListeners.add( "afterSave", f ).name = "onAfterSave";

  !onAfterSaveAsEvent.isValid && app.eventListeners.add( "afterSaveAs", f ).name = "onAfterSaveAs";

}

//function call

main();

HTH,

Loic

http://www.ozalto.com

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 Beginner ,
Mar 31, 2015 Mar 31, 2015

Copy link to clipboard

Copied

That's strange, it works on my system. Try this version:

#targetengine "storeTitleXMP"

var myEventListener = app.addEventListener("beforeSave", function (myEvent) {

var doc = app.documents[0];

var docTitle = (doc.name);

var myDocXMP = app.activeDocument.metadataPreferences;

var destNamespace = "http://ns.adobe.com/xap/1.0/";

var destNodeName = "InDesignFileName";

var nodeValue = docTitle;

myDocXMP.setProperty(destNamespace, destNodeName, nodeValue);

}

).name = "storeTitleXMP";

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 Beginner ,
Mar 31, 2015 Mar 31, 2015

Copy link to clipboard

Copied

Okay still having the same error…

I have created a .txt document and pasted in;

#targetengine "storeTitleXMP"

var myEventListener = app.addEventListener("beforeSave", function (myEvent) {

var doc = app.documents[0];

var docTitle = (doc.name);

var myDocXMP = app.activeDocument.metadataPreferences;

var destNamespace = "http://ns.adobe.com/xap/1.0/";

var destNodeName = "InDesignFileName";

var nodeValue = docTitle;

myDocXMP.setProperty(destNamespace, destNodeName, nodeValue);

}

).name = "storeTitleXMP";

Then saved the file naming it; storeTitleXMP.jsx and moved the file to the startup scripts in Indesign.

Is this correct??

Thanks again

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 Beginner ,
Mar 31, 2015 Mar 31, 2015

Copy link to clipboard

Copied

I just followed the instructions just as you described them (copying the script directly from you comment above) and it worked fine for me.

It may be that you are storing the text file in rich text format.

give me your email and I will send you the script as a plain text file.

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 Beginner ,
Mar 31, 2015 Mar 31, 2015

Copy link to clipboard

Copied

Hi James,

It’s pcollins@redtagdm.co.uk

Thanks

Paul

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 ,
Jan 11, 2017 Jan 11, 2017

Copy link to clipboard

Copied

Hi Paul

Found this thread and wondered if you and James found a resolution for this.

I tried the above but I appeared to experience the same issues as you did.

Be good to know if you solved it

Ta

Jo

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
Advisor ,
Jan 11, 2017 Jan 11, 2017

Copy link to clipboard

Copied

Please use NOTEPAD or similar text editor.
save the file as .jsx

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 ,
Jan 12, 2017 Jan 12, 2017

Copy link to clipboard

Copied

thanks Vamitul

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
Explorer ,
Feb 09, 2021 Feb 09, 2021

Copy link to clipboard

Copied

Hi all,

 

I want to adjust this script so it saves the INDD name to the PDF 'Subject', not title. What needs to 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
Explorer ,
Feb 09, 2021 Feb 09, 2021

Copy link to clipboard

Copied

Hi James,

 

I want to adjust this script so it saves the INDD name to the PDF 'Subject' (or keywords, copyright... anything really), not title. What needs to 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
Participant ,
Feb 07, 2022 Feb 07, 2022

Copy link to clipboard

Copied

Above script replace the title with file naming, can you please re-edit the script through which only author name can be customize.

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
Explorer ,
May 08, 2023 May 08, 2023

Copy link to clipboard

Copied

LATEST

I've tried this in Indesign 18.2.1 and it doesn't work. Does anyone have an updated script to add Indesign filename into Document Title and the author into author field. I know nothing about scripting but as others have said, clients change the filename of pdfs all the time, so embedding this info into the indesign doc before export would be super helpful.

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