Hi Mark, you really rock!!, the script works beautifully...it took a couple of seconds but no chocking with my humble 5 artboard test, let see how it goes with the real world file. I took the liberty of fixing the errors for you, I swapped the underscore with the dash, and added a couple of lines to include the artboardRange property, you would have easily spotted if you had CS5. a couple of notes on the whole exercise, saving as...and checking the option to use "All" artboards in the UI (empty string in JS), saves the active file + all separate artboards. Entering the Range manually 1-5 for example, saves only the arboards, and leaves the active document alone and open. #target illustrator function artboardsToPDFs() { if (app.documents.length = 0) { return; } else { var docRef = app.activeDocument; var docName = docRef.name; var baseName = docName.replace(/.ai$/,''); var dF = Folder(Folder.desktop + "/AI PDF's"); if (!dF.exists) dF.create(); var aB = docRef.artboards; var outFiles = Array(); for (var i = 0; i < aB.length; i++) { var abName = aB.name; outFiles.push(File(dF.fsName + '/' + baseName + '_' + abName + '.ai')); //changed '-' to '_' } var aiOpts = new IllustratorSaveOptions(); //aiOpts.compatability = Compatability.ILLUSTRATOR13; aiOpts.pdfCompatible = true; aiOpts.saveMultipleArtboards = true; //************************************ added 2 lines var abRange = "1-"+aB.length; aiOpts.artboardRange = abRange; //************************************ var saveFile = File(dF.fsName + '/' + docName); docRef.saveAs(saveFile, aiOpts); renameFiles(outFiles); } } artboardsToPDFs(); function renameFiles(fL) { for (var i = 0; i < fL.length; i++) { if (fL.exists) { fL.rename(fL.name.replace('_','-')); // swapped dash with underscore fL.rename(fL.name.replace(/\.ai$/,'\.pdf')); } } }
... View more