Skip to main content
Inspiring
January 12, 2017
Question

Write metadata in indb (indesign book) by an extendscript

  • January 12, 2017
  • 3 replies
  • 1214 views

Hello,

I found a manner to insert metadata in the File info of a document, but I search for a manner to do that on book level.

Is there a possibility to do that? In my code below, extendscript crashes on the line "if (book.textVariables".

I also did not found an answer on the internet if it is possible or not.

Kind regards

var book=app.activeBook

var myText=prompt("Installation manuals, Operation manuals, Installer reference guide, User reference guide, Option handbooks, General safety precautions, Declaration of Conformity. In case you have an Information and operation manual, you must input Installation manuals; Operation manuals (remark the ;)","Installation manuals","Fill in the required tags");

if (book.textVariables.item('Document Title').isValid){

    book.textVariables.item('Document Title').variableOptions.contents = myText;

}

else {

    // there's no variable named 'Document Title'

}

This topic has been closed for replies.

3 replies

Loic.Aigon
Legend
January 20, 2017

Marijan Tompa also introduced this in a more friendly manner with a series of blog posts:

xmp | Search Results | IndiSnip [InDesign® Snippets]

Loic.Aigon
Legend
January 19, 2017

Hi @Trevor,

Unless I am wrong indb files can't host XMP metadata. At least when I try to edit an indb xmp through bridge, fields are greyed. So I think it's a deadend anyway.

Trevor:
Legend
January 12, 2017

Hi

Books don't have textVariables, documents do.

There's no metadataPreferences properties for books either, so that could explain why you can't find anything on it.

I think your looking for something that can't be found, or that I don't know what your looking for,

Trevor

jessevicAuthor
Inspiring
January 12, 2017

Thanks for answer. If I create a pdf of the indesign book file, the filename of the bookfile will be automatically inserted in the metadata. Really no way at all to force the change of the metadata by an inputbox?

There is maybe an option to first create all pdf's of book files and after creation running a script by extendscript in acrobat to modify the metadata. But it sounds so strange that you cannot change the metadata directly in Indesign. :-)

Loic.Aigon
Legend
January 18, 2017

What you describe is feasible somehow but hazardous to say the least. You can imagine a script that would open every single file that is attached to a book, so you can write the book name in the xmp data. But, what if the file is removed from the book, what if the file is shared across multiple books ?