I have a Log file for when a file is Saved and when a File is PDF'd. Seperate i can get these to work. but when i place them in the same Script at best only 1 will work. How can i fix this? app.addEventListener( "beforeExport", doPDFinfo ); app.addEventListener( "beforeSave", doSaveINDDinfo ); //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Logs Information when File is Saved ( InddSave.csv ) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\\ function doSaveINDDinfo(){ var main = function() { var ids ={}; var el = app.eventListeners.itemByName('onAfterSave'), onAfterExportHandler = function(evt){ var doc = evt.parent, time; if ( doc.constructor.name=="Document" ) { if ( !ids[doc.id+"_"+evt.timeStamp] ) { ids[doc.id+"_"+evt.timeStamp] = 1; log ( evt ); } } }; !el.isValid && app.eventListeners.add('beforeSave', onAfterExportHandler).name = 'onAfterSave'; } var log = function (evt){ var headers = ["Indesign User Name", "Time", "Date", "Document Name", "Document path"]; var exportFile = File ( evt.fullName ); var f = File ( Folder("/Volumes/PPG/z-z MISC STUFF")+"/InddSave.csv" ); var fOk = f.exists; var d = (new Date()); var m = d.getMonth()+1; m<10 && m = "0"+m; var hh = d.getHours(); var pm = hh>11; pm && hh>12 && hh-=12; hh<10 && hh = "0"+hh; var mm = d.getMinutes(); mm< 10 && mm = "0"+mm; var doc = evt.parent; f.open('a'); !fOk && f.writeln ( headers.join(";") ); f.writeln([app.userName, hh+":"+mm+" "+(pm? "PM":"AM"), m+"/"+d.getDate()+"/"+d.getFullYear(), exportFile.fsName, doc.name, doc.properties.fullName? doc.fullName : "Not saved" ].join(";") ); f.close(); }; main(); } //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Logs Information when File is exported ( exports.csv ) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\\ function doLOGinfo(){ var main = function() { var ids ={}; var el = app.eventListeners.itemByName('onAfterExport'), onAfterExportHandler = function(evt){ var doc = evt.parent, time; if ( doc.constructor.name=="Document" ) { if ( !ids[doc.id+"_"+evt.timeStamp] ) { ids[doc.id+"_"+evt.timeStamp] = 1; log ( evt ); } } }; !el.isValid && app.eventListeners.add('afterExport', onAfterExportHandler).name = 'onAfterExport'; } var log = function (evt){ var headers = ["Indesign User Name", "Time", "Date", "Output Location and Name", "Document Name", "Document path"]; var exportFile = File ( evt.fullName ); var f = File ( Folder("/Volumes/PPG/z-z MISC STUFF")+"/exports.csv" ); var fOk = f.exists; var d = (new Date()); var m = d.getMonth()+1; m<10 && m = "0"+m; var hh = d.getHours(); var pm = hh>11; pm && hh>12 && hh-=12; hh<10 && hh = "0"+hh; var mm = d.getMinutes(); mm< 10 && mm = "0"+mm; var doc = evt.parent; f.open('a'); !fOk && f.writeln ( headers.join(";") ); f.writeln([app.userName, hh+":"+mm+" "+(pm? "PM":"AM"), m+"/"+d.getDate()+"/"+d.getFullYear(), exportFile.fsName, doc.name, doc.properties.fullName? doc.fullName : "Not saved" ].join(";") ); f.close(); }; main(); }
... View more