Sorry, I missunderstood your question, try now. var doc = app.activeDocument; app.doScript(exportJPG, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT); function exportJPG() { var obj = []; for(var i=0;i<app.selection.length;i++) { obj.push(app.selection); } var grp = doc.groups.add(obj); app.select(grp); grp.exportFile(ExportFormat.JPG, new File(app.activeDocument.fullName.toString().replace(".indd",".jpg"))); } try{doc.undo();}catch(e){}
... View more