标签:hot reg null regexp name imu jpeg log ref
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(); }
标签:hot reg null regexp name imu jpeg log ref
原文地址:http://www.cnblogs.com/huangshiyu13/p/6639745.html