PNG creation with modified date
HI,
The following steps are doing.
1) Open two indesign files. One is source and another one is final file.
2) Based on modified date I need to create the png with file naming as _source and _final.
mains();
function mains() {
var docSou = app.documents[0];
var docFin = app.documents[1];
var SouName = File(docSou.fullName);
var FinName = File(docFin.fullName);
var modifiedDate1= SouName.modified;
var modifiedDate2= FinName.modified;
mycheck1();
function mycheck1(){
if(modifiedDate1<modifiedDate2){
var docName =docSou.name.replace(/\.[^\.]+$/, '_source');
set_png_export_options();
var file = new File("~/Desktop"+"/"+docName+".png");
docSou.exportFile(ExportFormat.PNG_FORMAT, file);
mycheck2();
exit();
}
else{
var docName =docFin.name.replace(/\.[^\.]+$/, '_final');
set_png_export_options();
var file = new File("~/Desktop"+"/"+docName+".png");
docFin.exportFile(ExportFormat.PNG_FORMAT, file);
mycheck3();
exit();
}
}
function mycheck2(){
var docName =docFin.name.replace(/\.[^\.]+$/, '_final');
var file = new File("~/Desktop"+"/"+docName+".png");
docFin.exportFile(ExportFormat.PNG_FORMAT, file);
}
function mycheck3(){
var docName =docSou.name.replace(/\.[^\.]+$/, '_source');
var file = new File("~/Desktop"+"/"+docName+".png");
docSou.exportFile(ExportFormat.PNG_FORMAT, file);
}
}
function set_png_export_options() {
with(app.pngExportPreferences) {
antiAlias = true;
embedColorProfile = true;
exportResolution = 1600;
exportingSpread = true;
PNGColorSpace = PNGColorSpaceEnum.RGB;
PNGExportRange = PNGExportRangeEnum.EXPORT_ALL;
PNGQuality = PNGQualityEnum.MAXIMUM;
simulateOverprint = false;
transparentBackground = false;
useDocumentBleeds = true;
}
}
But it always show the first document as _source.
Could you please suggest where I am missing.
Regards,
K
