Copy link to clipboard
Copied
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'
}
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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. 🙂
Copy link to clipboard
Copied
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 ?
Copy link to clipboard
Copied
Just thinking out loud.
I think you can use the XMP library from InDesign or whatever app (Illustrator, ESTK, Photoshop etc.) you want to set the metadata on any file (i.e. mp3, mp4, png, pdf etc. ).
I think the documentations in the Bridge SDK.
There's 3 PDFs on the topic (I think it's a few hundred pages - but it's easy reading and you can jump around )
One can Google it.
If so after the PDF's been generated one can automatically set the PDFs desired XMP values with InDesign.
I think that even if the PDF open it should still work you will just not see the new XMP until the PDFs reopened.
Trevor
Copy link to clipboard
Copied
This method would avoid the hazards that Loic described
Copy link to clipboard
Copied
Trevorׅ wrote:
If so after the PDF's been generated one can automatically set the PDFs desired XMP values with InDesign.
Trevor
Copy link to clipboard
Copied
Yeah you can do it with a PDF for sure. Was just saying it wasn't fro indb as asked by our friend
Copy link to clipboard
Copied
Just noticed that chapter 10 of the JavaScripts Tools Guide is on "Scripting Access to XMP Metadata"
So you can see from there how to apply the metadata to the PDFs from InDesign
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Marijan Tompa also introduced this in a more friendly manner with a series of blog posts: