Batch Remove Guides If they Exists
Hello guys,
I am using Illustrator CC 2017 and I have a bunch of files which may or may not have guides.
After going through various threads, I came up with a script to remove Guides automatically if they exist but somehow it is getting stuck while saving the file.
Here is the javascript
sourceFolder = Folder.selectDialog();
// filesToProcess = sourceFolder.getFiles("*.ai");
var TypeList = prompt("Enter file types to act on","ai,eps,pdf","File Types");
var reg = new RegExp("\.(" + TypeList.replace(/,/g, '|') + ")$", 'i');
var filesToProcess = sourceFolder.getFiles(reg);
// Increment through the files
for (i=0; i < filesToProcess.length; i++) {
app.open(filesToProcess);
var myDoc=app.activeDocument;
// Remove Guides
for(var i = myDoc.pathItems.length-1; i >= 0; i--) {
var p = myDoc.pathItems;
if (p.guides == true) {
p.remove();
}
}
// Save
var mySaveOptions = new IllustratorSaveOptions();
mySaveOptions.pdfCompatible = true;
myDoc.saveAs(filesToProcess,mySaveOptions);
myDoc.close();
}
here is the link to the test Illustrator file https://drive.google.com/open?id=0B8FDkTEOTC4POUNpLXFtSUl0YzQ
it would be really great if someone could help me fix it.
Thanks
