Hello everyone!!
I'm newbie to Indesign script and I want to write script to export activeDocument to JPG with its metadataPreferences? I don't know it's possible or not? or have any way to do it?
Below is my code:
-----
var exportJpg = function() {
var saveFile = File.saveDialog("Save your files","*.jpg");
var mydoc = app.activeDocument;
app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.MAXIMUM;
mydoc.metadataPreferences.description = "It's description to write";
mydoc.exportFile(ExportFormat.JPG, saveFile, false);
}
exportJpg();
----
I wish anyone know and share their knowledge or give comments. Thank you in advance!!
Best Regards;
kuyseng.
Great Thank for your Guide!! Now I can find the code:
----
var exportJpg = function() {
var saveFile = File.saveDialog("Save your files","*.jpg");
var mydoc = app.activeDocument;
app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.MAXIMUM;
mydoc.metadataPreferences.description = "It's description to write";
mydoc.exportFile(ExportFormat.JPG, saveFile, false);
if (ExternalObject.AdobeXMPScript == undefined)
ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
var xmpFile = new XMPFile(saveFile.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);
var xmp = xmpFile.getXMP();
xmp.deleteProperty(XMPConst.NS_DC, "description");
xmp.setLocalizedText( XMPConst.NS_DC, "description", null, "x-default", "It's description to write");
if (xmpFile.canPutXMP(xmp)) {
xmpFile.putXMP(xmp);
}
xmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
}
exportJpg();
---
North America
Europe, Middle East and Africa
Asia Pacific