Try this.
var doc = app.activeDocument; app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.exportRange; app.jpegExportPreferences.pageString = doc.pages[0].name; doc.exportFile(ExportFormat.JPG, new File(doc.fullName.toString().replace(/\.indd$/i,".jpg")), false);
Regards,
Chinna