function saveEPS( doc, saveFile ) { var saveOptions = new JPEGSaveOptions( ); saveOptions.encoding = SaveEncoding.JPEGMAXIMUM; doc.saveAs( saveFile, saveOptions, true ); } function getAllFiles(folderName,houzhui){ folderName var regthis = new RegExp( ‘.+\.(‘+houzhui+‘)$‘,‘i‘); var inFolder = new Folder(folderName) var fileList = null if(inFolder != null){ var fileList = inFolder.getFiles(regthis); } return fileList } function print(mess){ alert(mess) } function checkFolder(path){ var folder = Folder(path) if(!folder.exists) folder.create() } var inDir = ‘~/imagesPaper/‘ var outDir = ‘~/imagesPaper/‘ checkFolder(outDir) files = getAllFiles(inDir,‘eps‘) for(var a = 0 ;a < files.length; a++) { //var fileRef = new File(fileList[a]); file = files[a] var doc = open(file); var ll = file.name.split(‘.‘) var shortName = ll[ll.length-2]; saveEPS( doc, new File(outDir+shortName+‘.eps‘) ); doc.close(); }
时间: 2024-10-19 14:43:47