script to write to PDF metadata upon export
I want to adjust this script so it saves the INDD filename to the PDF 'Subject' (or keywords, copyright... anything really), not title. What needs to change? The reason is that our filenames are often edited prior to being hosted online, losing our file references, and the Title is edited so it displays as required when selected online. I want to retain our original filename (from the export) so we can trace it at a later date. Ideally, this would be for INDD and AI.
The script was posted by JamesHaney here: https://community.adobe.com/t5/indesign/indesign-filename-into-the-meta-data-automatically/td-p/7020770
–––––––––––––––––––––––––––––––––––––––––
#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";

